// Use this for initialization void Awake() { // First, set barScaleFactor such that the height of the health bars is the upper 20% of the screen. barScaleFactor = (0.2f * Screen.height) / barTextureHeight; // 793 x 289 is the scale for the health bar png. barTextureLength *= barScaleFactor; barTextureHeight *= barScaleFactor; xOffset = (int) (0.3f * barTextureLength); yOffsetHealth = (int) (0.35f * barTextureHeight); yOffsetSpecial = (int) (0.5f * barTextureHeight); // Initialize character attributes charCombat = character.GetComponent<CombatScript> (); charMover = character.GetComponent<MovementAnimationScript> (); startHealth = charCombat.startHealth; charOnLeft = !charMover.facingLeft; // Initialize special attack strength. maxSpecialStrength = charCombat.maxSpecialStrength; // The health bar will be flipped and shifted from the left side of the screen // if the character's position is on the right. if (!charOnLeft){ float spaceFromLeft = (float) (1f - (1.02 * (barTextureLength/Screen.width))); barPosition = Camera.main.ViewportToScreenPoint( new Vector3( spaceFromLeft, 0.01f, 0f) ); } else { barPosition = Camera.main.ViewportToScreenPoint( new Vector3(0f, 0.01f, 0f) ); } // Debug.Log (gameObject + "'s barPosition is: " + barPosition); // Debug.Log ("The bar length and height for " + gameObject + " are: " + barTextureLength + " and " + barTextureHeight); }
// Use this for initialization void Start() { mover = gameObject.GetComponent<MovementAnimationScript> (); friendly = !mover.enemy; friendlyAxes = new string[4] {"P1 - Dash", "P1 - Block", "P1 - Punch", "P1 - Special"}; enemyAxes = new string[4] {"P2 - Dash", "P2 - Block", "P2 - Punch", "P2 - Special"}; }
// Use this for initialization void Start() { if (playerChar == null) { playerChar = GameObject.Find ("Linda Left"); } charMover = playerChar.GetComponent<MovementAnimationScript> (); resourceMap = new Dictionary<int, Texture2D>() { {2, (Texture2D) Resources.Load ("combo2")}, {3, (Texture2D) Resources.Load ("combo3")}, {4, (Texture2D) Resources.Load ("combo4")} }; }
// Use this for initialization void Start() { currentHealth = startHealth; startTime = Time.time; mover = GetComponent<MovementAnimationScript> (); mover.fighterAnimation.RegisterColliderTriggerDelegate (receiveColliderTriggerEvent); counterSpawner = GameObject.Find ("God").GetComponent<CounteredSpawner> (); }