private void Awake()
 {
     chaseState = new ChaseState(this);
     alertState = new AlertState(this);
     patrolState = new PatrolState(this);
     aim = GetComponent<Aim>();
     autoFire = GetComponent<AutoFire>();
 }
Ejemplo n.º 2
0
        public virtual void Draw()
        {
            Vector3 direction = Vector3.Zero;

            if (Input.Global.GetKeyDown(Keys.Left))
            {
                direction += Vector3.Left;
            }
            if (Input.Global.GetKeyDown(Keys.Up))
            {
                direction += Vector3.Up;
            }
            if (Input.Global.GetKeyDown(Keys.Right))
            {
                direction += Vector3.Right;
            }
            if (Input.Global.GetKeyDown(Keys.Down))
            {
                direction += Vector3.Down;
            }

            direction.Normalize();
            float speed = Speed;

            if (Input.Global.GetKeyDown(Keys.ShiftKey))
            {
                speed = SlowSpeed;
            }
            OnMove(Position, direction * speed);
            Position += direction * Time.DeltaTimeSeconds * speed;
            Position  = STG.Math.Box(Position, Width / 2, Height / 2);

            Matrix mat = Matrix.Translation(Position);

            Resource.device.SetTransform(TransformState.World, mat);
            DrawSprite();

            bullets.FrameUpdate();

            if (AutoFire != null)
            {
                AutoFire.Enable = Input.Global.GetKeyDown(Keys.Z);
                AutoFire.FrameUpdate();
            }
        }
 private void FrenzyMagicEffect()
 {
     //debugGUIText.text = "Frenzy";
     player = GameObject.FindWithTag("Player");
     autoFire = player.GetComponentInChildren<AutoFire>();
     originalDamagePerSecond = autoFire.damagePerSecond;
     autoFire.damagePerSecond *= 2;
     //Invoke("DisableFrenzyMagicEffect", 4f);
 }
 private void DisableFrenzyMagicEffect()
 {
     player = GameObject.FindWithTag("Player");
     autoFire = player.GetComponentInChildren<AutoFire>();
     autoFire.damagePerSecond = originalDamagePerSecond;
 }