private ActorVariables Variables; //Global variables for this object private void Start() { oldDir = Vector2.zero; //Start with a default zero vector for old direction animator = GetComponent <Animator>(); //Reference to the objects animator spriteRend = GetComponent <SpriteRenderer>(); //Reference to the Sprite renderer for the object Variables = GetComponent <ActorVariables>(); //Reference to this objects global variables }
private float Multiplier = 1; //Damage multiplier private void Start() { //Grab the weapon information from the Game Manager weapon = GameManager.GAMEMANAGER.getWeapons().weapons[(int)weaponType]; Rigidbody2D rb = GetComponent <Rigidbody2D>(); //Reference to the objects rigid body Variables = GetComponent <ActorVariables>(); //Reference to the objects global variables rb.freezeRotation = true; //freeze the rotation of rigid body rb.gravityScale = 0; //Set the gravity for the rigid body to zero }
private void Awake() { Variables = GetComponent <ActorVariables>(); //Variables that this object needs health = Variables.health; //Set the health to the default health in the variables script if (HealthBar != null) { HealthBar.maxValue = Variables.getDefaultHealth(); HealthBar.value = health; } }