-
Notifications
You must be signed in to change notification settings - Fork 0
/
splatterChooser.cs
36 lines (28 loc) · 1.03 KB
/
splatterChooser.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class splatterChooser : MonoBehaviour
{
SpriteRenderer spriteRenderer;
public Sprite[] splatterSprites;
void Awake(){
spriteRenderer = GetComponent<SpriteRenderer>();
// find det aktive våben
Weapon player = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren<weaponHolder>().activeWeapon;
// vælg splatter sprite baseret på våben brugt
switch(player.weaponSprite.name){
case "gatten":
spriteRenderer.sprite = splatterSprites[0];
break;
case "shotguntop1":
spriteRenderer.sprite = splatterSprites[3];
break;
case "batt":
spriteRenderer.sprite = splatterSprites[2];
break;
default:
spriteRenderer.sprite = splatterSprites[3];
break;
}
}
}