Example #1
0
        protected override void Execute(Entity <int> gameObject)
        {
            // Cast entity object to a GameBoss to use it's methods
            GameBoss boss = gameObject as GameBoss;

            // Execution steps
        }
        public override void MoveInPattern(Entity <int> boss)
        {
            // Cast to a GameBoss entity
            GameBoss gameBoss = boss as GameBoss;

            if (gameBoss.BossType == BossTypes.MidBoss)
            {
                double angle = Math.PI;
                for (double theta = 0; theta < Math.PI * 2; theta += angle)
                {
                    double speedX = Math.Sin(theta);
                    double speedY = Math.Cos(theta);

                    Position.X += (int)speedX;
                    Position.Y += (int)speedY;
                }
            }
            else if (gameBoss.BossType == BossTypes.FinalBoss)
            {
                // To Do: Final boss red bullet movement pattern logic
                //Circular motion
                double angle = (2 * Math.PI) / bulletsPerWave;
                for (double theta = 0; theta < (Math.PI * 2); theta += angle)
                {
                    double speedX = Math.Sin(theta);
                    double speedY = Math.Cos(theta);
                }
            }
        }
Example #3
0
    // Start is called before the first frame update
    void Start()
    {
        gameManager = GameObject.Find("GameManager").GetComponent <GameBoss>();
        targetRB    = GetComponent <Rigidbody>();
        targetRB.AddForce(RandomForce(), ForceMode.Impulse);
        targetRB.AddTorque(RandomTorque(), RandomTorque(),
                           RandomTorque(), ForceMode.Impulse);

        //transform.position = new Vector3(Random.Range(-4,4),-6);
        transform.position = (RandomSpawnPosition());
    }
Example #4
0
        public override void MoveInPattern(Entity <int> boss)
        {
            // Cast to a GameBoss entity
            GameBoss gameBoss = boss as GameBoss;

            //only the final boss is dhooting lasers for now
            if (gameBoss.BossType == BossTypes.FinalBoss)
            {
                //laser is being shot 8 times from pi/2 angle
                float angleOfLaser = (float)Math.Atan((referencePoint.Y - Position.Y) / (referencePoint.X - Position.X));
                if (referencePoint.X >= Position.X)
                {
                    angleOfLaser += (float)(Math.PI / 2);
                }
            }
        }