// Use this for initialization void Start() { //Set Healthbar currentHealth = maxHealth; healthFillTransform = healthFill.GetComponent <RectTransform>(); damageFillTransform = damageFill.GetComponent <RectTransform>(); healthFillScaleX = healthFillTransform.localScale.x; healthFillScaleY = healthFillTransform.localScale.y; //Set Healthbar ballCooldown = 0; ballAttackSprites.SetRect(); playerIndex = GetComponent <DragonManager>().playerIndex; //Find enemy dragon GameObject[] dragons = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject d in dragons) { if (d.GetComponent <DragonManager>().playerIndex != playerIndex) { enemyDragon = d.transform; } } enemyStats = enemyDragon.GetComponent <DragonStats>(); device = InputManager.Devices[playerIndex]; }
public float leftStickXValue = 0.1f; //The value of the left stick X at which the dragon will 'bank'. // Use this for initialization void Start() { flyController = GetComponent <DragonControllerFly>(); groundController = GetComponent <DragonControllerGround>(); idleFlyController = GetComponent <DragonControllerIdleFly>(); stats = GetComponent <DragonStats>(); rb = GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); flyController.enabled = false; idleFlyController.enabled = true; groundController.enabled = false; //if (InputManager.Devices.Count <= playerIndex) //{ // return; //} device = InputManager.Devices[playerIndex]; }