示例#1
0
        public void Shoot(float power)
        {
            //Debug.Log("Shoot");
            State = WormState.Busy;
            Vector2 spawnPos = GetSpawnPosition(CurrentWeapon.GetWidth(), CurrentWeapon.GetHeight(), Angle, 1.0f);
            //Debug.LogFormat("Spawn position to position : {0} / {1}", spawnPos, Position);
            RectObject proj = GameManager.GM.SpawnObject(CurrentWeapon.Projectile, spawnPos);

            proj.AddForce(GetAim() * power);
            //CurrentWeapon = null;
            SetSpriteShooting(Angle);
        }
示例#2
0
 /// <summary>
 /// If returns false, it won't bounce of the object.
 /// </summary>
 protected virtual bool OnCollideWithObject(RectObject other, ref Vector2 vel)
 {
     vel = vel / 2.0f;
     other.AddForce(-vel);
     return(true);
 }