Beispiel #1
0
 public void Cast(GameObject target, bool facingRight, float mod)
 {
     cooldownTimer    = Cooldown;
     inst             = UnityEngine.Object.Instantiate(Prefab).GetComponent <Castable>();
     inst.movingRight = facingRight;
     inst.AssignModifier(mod);
     inst.Cast(target);
 }
        protected override void formatSpawn(Castable spawn)
        {
            float speedMod = Random.Range(.6f, 1.2f);

            spawn.Speed *= speedMod;
            float angle = UnityEngine.Random.Range(-15f, 15f);

            spawn.transform.Rotate(0, 0, angle);
        }
        protected override void formatSpawn(Castable spawn)
        {
            float angle = -Mathf.Deg2Rad * UnityEngine.Random.Range(0, 180);
            //The y-coordinate in the rotation formula is not necesarry as we're rotating from <-1, 0> (Vector2.left)
            float x = -1 * Mathf.Cos(angle);
            float y = -1 * Mathf.Sin(angle);

            spawn.GetComponent <Rigidbody2D> ().velocity = new Vector2(x * Speed, y * Speed);
        }
Beispiel #4
0
        protected override void formatSpawn(Castable spawn)
        {
            float offset = Random.Range(minXOffset, maxXOffset);

            Debug.Log("Offset was: " + offset);

            Vector3 randPos = transform.position + new Vector3(offset, 0);

            spawn.transform.position = randPos;
        }
Beispiel #5
0
        protected void formatSpawn(Castable spawn)
        {
            spawn.AssignModifier(damageModifier);
            //Move bolt to top of volcano
            spawn.transform.position = transform.position + new Vector3(0, 1.5f);

            //Calculate a random direction to shoot the bolt.
            float angle = -Mathf.Deg2Rad * UnityEngine.Random.Range(0, 180);
            //The y-coordinate in the rotation formula is not necesarry as we're rotating from <-1, 0> (Vector2.left)
            float x = -1 * Mathf.Cos(angle);
            float y = -1 * Mathf.Sin(angle);

            spawn.GetComponent <Rigidbody2D> ().velocity = new Vector2(x * Speed, y * Speed);
        }
 /// <summary>
 /// Formats the spawn according to the behaviour of the spell.
 /// </summary>
 /// <param name="spawn">Spawn.</param>
 protected abstract void formatSpawn(Castable spawn);
Beispiel #7
0
 protected override void formatSpawn(Castable spawn)
 {
     //No formatting needed.
 }