Ejemplo n.º 1
0
        public void ResPhasetest()
        {
            Player p1   = new Player(0);
            Player p2   = new Player(1);
            IGame  game = mocks.Stub <IGame>();

            Card attack = new Attack(CardSuit.Spade, 1);

            Phase       a    = new ActionPhase(p1);
            PhaseList   ret  = a.advance(new UseCardAction(attack, p2), game);
            Phase       b    = ret.pop();
            AttackPhase b2   = b as AttackPhase;
            Miss        miss = new Miss(CardSuit.Diamond, 2);

            p1.handCards.Add(attack);
            p2.handCards.Add(miss);
            p1.health = 1;

            Player[] p = new Player[1];
            p[0] = p1;
            ret  = b.advance(null, game);
            Phase         c  = ret.pop();
            ResponsePhase c_ = c as ResponsePhase;

            Assert.IsNull(c_.responseYesOrNo(true, game));
        }
Ejemplo n.º 2
0
        public void Res3Phasetest()
        {
            // ActionPhase produces attackPhase

            Player p1   = mocks.Stub <Player>(0);
            Player p2   = mocks.Stub <Player>(1);
            IGame  game = mocks.Stub <IGame>();

            Card attack = new Attack(CardSuit.Spade, 1);

            // ActionPhase produces attackPhase
            ActionPhase a    = new ActionPhase(p1);
            PhaseList   ret  = a.advance(new UseCardAction(attack, p2), game);
            Phase       b    = ret.pop();
            AttackPhase b2   = b as AttackPhase;
            Miss        miss = new Miss(CardSuit.Diamond, 2);

            p1.handCards.Add(attack);
            p1.handCards.Add(miss);
            p1.health = 1;

            Player[] p = new Player[1];
            p[0] = p1;
            // AttackPhase produces responsePhase
            ret = b.advance(null, game);
            Phase         c  = ret.pop();
            ResponsePhase c_ = c as ResponsePhase;

            Assert.AreEqual(c_.ToString(), "Response Phase of 1");
        }
Ejemplo n.º 3
0
        public void Res5Phasetest()
        {
            SunQuan     p1 = new SunQuan(0);
            LiuBei      p2 = new LiuBei(1);
            List <Card> x  = new List <Card>();

            Player[] p = new SunQuan[1];
            p[0] = p1;
            Miss miss   = new Miss(CardSuit.Diamond, 2);
            Card attack = new Attack(CardSuit.Spade, 1);

            x.Add(miss);
            x.Add(attack);
            Game game = new Game(p, new CardSet(x));



            // ActionPhase produces attackPhase
            ActionPhase a   = new ActionPhase(p1);
            PhaseList   ret = a.advance(new UseCardAction(attack, p2), game);
            Phase       b   = ret.pop();
            AttackPhase b2  = b as AttackPhase;

            p1.handCards.Add(attack);
            p1.handCards.Add(miss);
            p1.health = 1;

            // AttackPhase produces responsePhase
            ret = b.advance(null, game);
            Phase         c  = ret.pop();
            ResponsePhase c_ = c as ResponsePhase;


            Assert.IsInstanceOfType(a.responseAbilityActionSun(new AbilityActionSun(attack), game), typeof(PhaseList));
        }
Ejemplo n.º 4
0
 void Awake()
 {
     deploySolders   = this.GetComponent <DeploySoldiers> ();
     armyManagement  = this.GetComponent <ArmyManagement> ();
     globalFunctions = this.GetComponent <GlobalFunctions> ();
     phases          = this.GetComponent <Phases> ();
     attackPhase     = this.GetComponent <AttackPhase> ();
 }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        currentPhase        = CurrentPhase.None;
        _attackPhase        = new AttackPhase();
        currentUnitSelected = null;

        Current = this;
    }
Ejemplo n.º 6
0
 // Walk to the next choice spot and then pick a new option once there
 private void HandleEnd()
 {
     if (MoveToTarget(config.moveSpeed))
     {
         GetNextOption();
         curPhase = AttackPhase.Start;
     }
 }
Ejemplo n.º 7
0
    private void StartPhase2()
    {
        this._movement.MoveInDirection(Direction.None);
        this._animator.SetTrigger(AnimatorHelper.GetAnimatorParameterFromDirection(Direction.South));

        this._currentAttackPhase = AttackPhase.Phase2;
        Invoke(nameof(this.FreezeRotationAndStartFire), 1f);
        InvokeRepeating(nameof(this.ShuffleDragons), 0f, this._shuffleDragonsInterval);
    }
Ejemplo n.º 8
0
 // Walk to the starting position of the current attack
 private void HandleStart()
 {
     // Start the attack once boss has reached target position
     if (MoveToTarget(config.dashSpeed))
     {
         curPhase = AttackPhase.Attack;
         StartAttack();
     }
 }
Ejemplo n.º 9
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update Movement End Check
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdateMovementEndCheck()
 {
     // If it's expected that we will reach the target vector within the next frame or so. Set to fadeout animation.
     if (Vector2.Distance(Position.Get(), m_vTargetPos) < (m_fSpeed * Time.deltaTime * DISTANCE_TOLERANCE))
     {
         m_fFadeoutStartAlpha = SpriteColour.a;
         m_eAttackPhase       = AttackPhase.FADEOUT;
     }
 }
Ejemplo n.º 10
0
 public override void OnHitByAttack(AttackCollisionData xAtColData, AttackPhase xAtPhase)
 {
     base.OnHitByAttack(xAtColData, xAtPhase);
     fFurthestAllowedDistance = 500f;
     AddHitEffect();
     if (Utils.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Server)
     {
         SendClientInstruction(0);
     }
 }
Ejemplo n.º 11
0
 protected void Start()
 {
     // Vector3 tempLocalPos = transform.localPosition;
     // bool onRightSide = (transform.localPosition.x > 0f) ? true : false;
     // tempLocalPos.x = Mathf.Abs(tempLocalPos.x);
     // initialLocalPosition = tempLocalPos;
     // Debug.Log($"Initial Local Postition: {initialLocalPosition}");
     // Debug.Break();
     phase = AttackPhase.Startup;
 }
Ejemplo n.º 12
0
	private void Start() {
        jumping = false;
        rigidbody = this.GetComponent<Rigidbody2D>();
        direction = new Vector2();
        attackPhase = AttackPhase.NONE;
        nextAttackPhase = 0.0f;

        flipPhase = FlipPhase.NONE;
        nextFlipPhase = 0.0f;
	}
Ejemplo n.º 13
0
        public void AttackHitTest()
        {
            Player p1   = mocks.Stub <Player>(0);
            Player p2   = mocks.Stub <Player>(1);
            IGame  game = mocks.Stub <IGame>();

            Card attack = new Attack(CardSuit.Spade, 1);

            // ActionPhase produces attackPhase
            Phase     a   = new ActionPhase(p1);
            PhaseList ret = a.advance(new UseCardAction(attack, p2), game);
            Phase     b   = ret.pop();

            Assert.IsInstanceOfType(b, typeof(AttackPhase));
            AttackPhase b2 = b as AttackPhase;

            Assert.AreEqual(attack, b2.attack);
            Assert.AreEqual(a, b2.actionPhase);
            Assert.AreEqual(p1, b2.player);
            Assert.AreEqual(p2, b2.targets[0]);
            Assert.AreEqual(a, ret.pop());
            Assert.IsTrue(ret.isEmpty());
            // AttackPhase produces responsePhase
            ret = b.advance(null, game);
            Phase c = ret.pop();

            Assert.IsInstanceOfType(c, typeof(ResponsePhase));
            ResponsePhase c_ = c as ResponsePhase;

            Assert.AreEqual(p2, c_.player);
            Phase c2 = ret.pop();

            Assert.IsInstanceOfType(c2, typeof(AttackPhase));
            Assert.AreEqual(b, c2);
            Assert.IsTrue(ret.isEmpty());

            // response with cancel
            ret = c.advance(new YesOrNoAction(false), game);
            Assert.IsTrue(ret.isEmpty());

            // attackPhase produces harmPhase
            ret = c2.advance(null, game);
            Phase d = ret.pop();

            Assert.IsInstanceOfType(d, typeof(HarmPhase));
            HarmPhase d2 = d as HarmPhase;

            Assert.AreEqual(p2, d2.player);
            Assert.AreEqual(p1, d2.source);
            Assert.AreEqual(1, d2.harm);
            Assert.IsTrue(ret.isEmpty());

            ret = d.advance(null, game);
            Assert.IsTrue(ret.isEmpty());
        }
Ejemplo n.º 14
0
	void Start ()
    {
        babaYaga = GameObject.FindGameObjectWithTag("BabaYaga");
        maxPestelStrikes = 2 + babaYaga.GetComponent<BabaYaga>().aggressionPhase;
        pestelStrikeIntervals = 5 - (babaYaga.GetComponent<BabaYaga>().aggressionPhase);
        returning = false;
        strikeSpeed = strikeSpeed + (babaYaga.GetComponent<BabaYaga>().aggressionPhase * 50);
        animator = GetComponent<Animator>();
        attackPhase = AttackPhase.Rising;
        pestelStrikes = 1;
    }
Ejemplo n.º 15
0
    void Awake()
    {
        entity      = GetComponent <Entity>();
        moveTarget  = transform.position;
        attackPhase = AttackPhase.Approach;
        preferredCirclingDistance = Random.Range(
            preferredCirclingDistance,
            preferredCirclingDistance + 1f);

        attackFrequency = Random.Range(4, 7);
    }
Ejemplo n.º 16
0
 public override void OnHitByAttack(AttackCollisionData xAtColData, AttackPhase xAtPhase)
 {
     if ((!(xAtPhase.xStats.sAttackHandle != "Bomb") || CAS.DifficultySetting >= 3) && iCounter >= 30)
     {
         if (iCounter < iExplodeAt - 5)
         {
             iCounter = iExplodeAt - 5;
         }
         _ = iTimesHit;
         _ = iTimesToHitBeforeDestroy;
     }
 }
Ejemplo n.º 17
0
 private void HandleThrust()
 {
     if (curState == States.Attack)
     {
         Attack(player);
     }
     if (MoveToTarget(config.thrust.movement.x))
     {
         EndAttack();
         SelectPosition(quarter, true);
         curPhase = AttackPhase.End;
     }
 }
Ejemplo n.º 18
0
    public void UpdateApproach()
    {
        // move toward the attack target
        moveTarget = attackTarget.transform.position;
        StepTowards(moveTarget);

        // are we close enough to enter circle state?
        float distance = GetDistanceToAttackTarget();

        if (distance < preferredCirclingDistance)
        {
            attackPhase = AttackPhase.Circle;
        }
    }
Ejemplo n.º 19
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Reset
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    public void Reset()
    {
        m_ttFadeinTimer.Reset();
        m_ttFadeoutTimer.Reset();
        Impacted = false;
        m_ImpactTargetCollider = null;
        CollisionDetector      = true;
        m_eAttackPhase         = AttackPhase.FADEIN;
        m_vDirection           = (m_vTargetPos - (Vector2)transform.position).normalized;

        Color alpha = SpriteColour;

        alpha.a      = 0.0f;
        SpriteColour = alpha;
    }
Ejemplo n.º 20
0
        public void ZhangFeiAbtestnomocknull1()
        {
            {
                IGame       game  = mocks.Stub <IGame>();
                Player      p     = new ZhangFei(1);
                Attack      card  = new Attack(CardSuit.Club, 1);
                ActionPhase acpha = new ActionPhase(p);
                Player[]    ls    = new Player[1];
                ls[0] = new LiuBei(2);

                AttackPhase pha = new AttackPhase(p, card, ls, acpha);
                pha.actionPhase.attackCount = 1;
                Assert.IsFalse(p.canNotAttack(null, game));
            }
        }
Ejemplo n.º 21
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Fade in
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void FadeIn()
 {
     m_ttFadeinTimer.Update();
     if (m_ttFadeinTimer.TimeUp())
     {
         SpriteColour   = Color.white;
         m_eAttackPhase = AttackPhase.MOVING;
     }
     else
     {
         Color alpha = SpriteColour;
         alpha.a      = Mathf.Lerp(0.0f, 1.0f, m_ttFadeinTimer.GetCompletionPercentage());
         SpriteColour = alpha;
     }
 }
Ejemplo n.º 22
0
    protected virtual void FixedUpdate()
    {
        if (startupDuration > 0f)
        {
            startupDuration -= Time.fixedDeltaTime;
            if (phase != AttackPhase.Startup)
            {
                phase = AttackPhase.Startup;
                // Debug.Log(phase);
            }
        }
        else if (activeDuration > 0f)
        {
            if (activeDuration != Mathf.Infinity)
            {
                activeDuration -= Time.fixedDeltaTime;
                Color hitboxColor = new Color(255f, 0f, 0f, 96f);
                hitboxes[0].shape.gameObject.GetComponent <Renderer>().material.SetColor("_Color", hitboxColor);
                if (phase != AttackPhase.Active)
                {
                    phase = AttackPhase.Active;
                    // Debug.Log(phase);
                }
            }
        }
        else
        {
            recoveryDuration -= Time.fixedDeltaTime;
            hitboxes[0].shape.gameObject.GetComponent <Renderer>().material.SetColor("_Color", Color.red);
            if (phase != AttackPhase.Recovery)
            {
                phase = AttackPhase.Recovery;
                // Debug.Log(phase);
            }
        }

        if (startupDuration <= 0f && activeDuration > 0f)
        {
            hitboxes[0].shape.enabled = true;
        }
        if (recoveryDuration <= 0f)
        {
            hitboxes[0].shape.enabled = false;
            gameObject.SetActive(false);
        }
    }
Ejemplo n.º 23
0
        public void AttackMissTest()
        {
            Player p1 = mocks.Stub <Player>(0);
            Player p2 = mocks.Stub <Player>(1);

            IGame game = mocks.Stub <IGame>();

            Card attack = new Attack(CardSuit.Spade, 1);
            Miss miss   = new Miss(CardSuit.Diamond, 2);
            // ActionPhase produces attackPhase
            Phase     a   = new ActionPhase(p1);
            PhaseList ret = a.advance(new UseCardAction(attack, p2), game);
            Phase     b   = ret.pop();

            Assert.IsInstanceOfType(b, typeof(AttackPhase));
            AttackPhase b2 = b as AttackPhase;

            Assert.AreEqual(attack, b2.attack);
            Assert.AreEqual(a, b2.actionPhase);
            Assert.AreEqual(p1, b2.player);
            Assert.AreEqual(p2, b2.targets[0]);
            Assert.AreEqual(a, ret.pop());
            Assert.IsTrue(ret.isEmpty());
            // AttackPhase produces responsePhase
            ret = b.advance(null, game);
            Phase c = ret.pop();

            Assert.IsInstanceOfType(c, typeof(ResponsePhase));
            ResponsePhase c_ = c as ResponsePhase;

            Assert.AreEqual(p2, c_.player);
            Phase c2 = ret.pop();

            Assert.IsInstanceOfType(c2, typeof(AttackPhase));
            Assert.AreEqual(b, c2);
            Assert.IsTrue(ret.isEmpty());

            // response with cancel
            ret = c.advance(new CardAction(miss), game);
            Assert.IsTrue(ret.isEmpty());

            // attackPhase produces nothing
            ret = c2.advance(null, game);
            Assert.IsTrue(ret.isEmpty());
        }
Ejemplo n.º 24
0
    private void CheckHealthAndUpdateCurrentAttackPhase()
    {
        if (this._currentHealth <= 2f * this.MaxHealth / 3f && this._currentAttackPhase == AttackPhase.Phase1)
        {
            this._currentAttackPhase = AttackPhase.Phase2;
            this.StartPhase2();
        }

        if (this._currentHealth <= this.MaxHealth / 3f && this._currentAttackPhase == AttackPhase.Phase2)
        {
            this._currentAttackPhase = AttackPhase.Phase3;
            this.StartPhase3();
        }

        if (this._currentHealth <= 0)
        {
            this._isDead = true;
        }
    }
Ejemplo n.º 25
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* Derived Method: On Collision
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void OnTriggerEnter2D(Collider2D collider)
    {
        if (!Impacted && collider.tag.Contains("Enemy"))
        {
            Enemy_Base enemy = collider.gameObject.GetComponent <Enemy_Base>();
            if (enemy.Hurtable && ImpactPossible(collider))
            {
                m_ImpactTargetCollider = collider;

                enemy.IsFrozen = true;                          // Also freeze it from moving
                Vector3 impactPosition = Position;
                Position.Set(enemy.Position);                   // Lock fireball impact animation to the current position of the enemy
                CollisionDetector = false;                      // Turn off the Collision Detector


                Impacted       = true;
                m_eAttackPhase = AttackPhase.IMPACT;
                StartCoroutine(OnImpact(enemy, impactPosition));
            }
        }
    }
Ejemplo n.º 26
0
    protected virtual void OnEnable()
    {
        // transform.eulerAngles = new Vector3(0f, 0f, hitboxes[0].knockbackAngle);
        startupDuration = hitboxes[0].startup * Time.fixedDeltaTime;
        if (hitboxes[0].timeActive == 0)
        {
            activeDuration = Mathf.Infinity;
        }
        else
        {
            activeDuration = hitboxes[0].timeActive * Time.fixedDeltaTime;
        }
        recoveryDuration = hitboxes[0].recovery * Time.fixedDeltaTime;

        Vector3 tempLocalPos = transform.localPosition;

        // bool onRightSide = (transform.localPosition.x > 0f) ? true : false;
        // tempLocalPos.x = Mathf.Abs(tempLocalPos.x);
        initialLocalPosition = tempLocalPos;
        phase = AttackPhase.Startup;
        initialKnockbackAngle = hitboxes[0].knockbackAngle;
    }
Ejemplo n.º 27
0
    public void UpdateClose()
    {
        // calculate vector to target
        Vector3 attackDirection = transform.position - attackTarget.transform.position;

        // if within attack distance, switch mode
        if (attackDirection.magnitude <= closeDistance)
        {
            attackPhase = AttackPhase.Attack;

            //Slasher slasher = GetComponent<Slasher>();
            //slasher.DashForward();
        }
        // otherwise keep closing
        else
        {
            attackDirection = VectorUtil.Set2DLength(attackDirection, attackDirection.magnitude * 0.1f);
            // maybe keep circling while closing?
            attackDirection = VectorUtil.RotateByDegrees(attackDirection, 1);
            moveTarget      = attackTarget.transform.position + attackDirection;
            StepTowards(moveTarget);
        }
    }
Ejemplo n.º 28
0
    public void ChangePhase(AttackPhase phase)
    {
        if (this.enabled == false)
        {
            return;
        }
        this.phase = phase;

        if (this.phase == AttackPhase.Idle)
        {
            anim.CrossFadeInFixedTime("Idle", 0.5f);
        }
        else if (this.phase == AttackPhase.RockStorm)
        {
            cycle = AttackCycle.RockStorm;
            anim.SetBool("punching", false);
            anim.SetBool("rockstorm", true);
        }
        else if (this.phase == AttackPhase.ThrowRocks)
        {
            anim.CrossFadeInFixedTime("throwDebris", 0.5f);
        }
    }
Ejemplo n.º 29
0
    private void HandleBeam()
    {
        if (!atCorner)
        {
            if (MoveToTarget(config.beam.movement.x))
            {
                atCorner = true;
                BeginAttack(config.beam);
            }
        }

        else
        {
            HandleProjectile();

            // Walk to nearest choice spot once attack is done
            if (curState != States.Attack)
            {
                curPhase = AttackPhase.End;
                SelectPosition(quarter, true);
            }
        }
    }
Ejemplo n.º 30
0
    void OnCollisionEnter2D(Collision2D coll) {
        if (coll.contacts[0].normal.y == 1.0f) {
            jumping = false;
            if (attackPhase == AttackPhase.MIDDLE) {
                nextAttackPhase = Time.time + 0.1f;
                speed = normalSpeed * 0.5f;

                // Hit the enemy.
                if (coll.gameObject.tag == "Enemy") {
                    Enemy enemy = coll.gameObject.GetComponent<Enemy>();
                    if (enemy != null) {
						SoundSingleton.Singleton.PlaySmashEnemy ();
                        enemy.setLife(enemy.getLife() - 1);
                    }
                }
            }
            attackPhase = AttackPhase.END;
        }

        if (coll.gameObject.tag == "Wall") {
            if (flipPhase == FlipPhase.NONE) {
                flipPhase = FlipPhase.TOUCHING;
            }
        }
    }
Ejemplo n.º 31
0
	private void Update() {
        if (GameManager.endGame) {
            return;
        }
        if (movingRight) {
            direction.x = 1.0f;
        } else {
            direction.x = -1.0f;
        }

        if (attackPhase == AttackPhase.END && Time.time > nextAttackPhase) {
            speed += normalSpeed * Time.deltaTime;
            if (speed > normalSpeed) {
                speed = normalSpeed;
                attackPhase = AttackPhase.NONE;
            }
        }

        if (flipPhase == FlipPhase.FLIPPLING && Time.time > nextFlipPhase) {
            flipPhase = FlipPhase.NONE;
        }

        if (playerStats.IsDead() == false) {
            if (Input.GetKeyDown(KeyCode.Space) || (Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began)) {
                action = true;
            }
            else {
                action = false;
            }
        }

        if ((int)attackPhase > 0) {
            if (Time.time > nextAttackPhase) {
                if (attackPhase == AttackPhase.BEGIN) {
					SoundSingleton.Singleton.PlayAttackPlayer ();
                    rigidbody.velocity = new Vector2(0.0f, 0.0f);
                    rigidbody.AddForce(new Vector2(0.0f, -jumpSpeed * 0.8f), ForceMode2D.Impulse);
                    attackPhase = AttackPhase.MIDDLE;
                }
            }
        } else {
            if (action) {
                if (flipPhase == FlipPhase.TOUCHING) {
                    flipPhase = FlipPhase.FLIPPLING;
                    movingRight = !movingRight;

                    Vector3 theScale = transform.localScale;
                    theScale.x *= -1;
                    transform.localScale = theScale;

                    nextFlipPhase = Time.time + 1.0f;
                }
                else if (!jumping) {
                    rigidbody.AddForce(new Vector2(0.0f, jumpSpeed), ForceMode2D.Impulse);
                    jumping = true;
                }
                else {
                    if (attackPhase == AttackPhase.NONE) {
                        attackPhase = AttackPhase.BEGIN;
                        nextAttackPhase = Time.time + 0.05f;
                    }
                }
            }
        }

        if (animator != null) {
            animator.SetBool("movingRight", movingRight);
            animator.SetBool("jumping", jumping);
            animator.SetBool("attacking", (attackPhase == AttackPhase.MIDDLE));
        }
	}
Ejemplo n.º 32
0
    void StrikeTheBlood()
    {
        if (pestelStrikes <= maxPestelStrikes)
        {
            if (attackPhase == AttackPhase.Rising)
            {
                animator.Play("FreeIdle");
                if (transform.position.y < targetHeight)
                {
                    transform.Translate(new Vector3(0, 1) * Time.deltaTime * strikeSpeed, Space.World);
                }
                else
                {
                    intervalTimer = pestelStrikeIntervals;
                    attackPhase = AttackPhase.Moving;
                }
            }

            if (attackPhase == AttackPhase.Striking)
            {
                if (transform.position.y > floor)
                {
                    transform.Translate(new Vector3(0, -1) * Time.deltaTime * strikeSpeed, Space.World);
                    animator.Play("Striking");
                }
                else
                {
                    pestelStrikes++;
                    attackPhase = AttackPhase.Rising;
                }
            }

            if (attackPhase == AttackPhase.Moving)
            {
                intervalTimer -= Time.deltaTime;

                if (intervalTimer <= 0)
                {
                    animator.Play("StrikeSignal");
                }
                else
                {
                    animator.Play("FreeIdle");
                    float playerPositionX = GameObject.FindGameObjectWithTag("Player").transform.position.x;
                    int fudgeFactor = 1;

                    if (transform.position.x >= playerPositionX - fudgeFactor && transform.position.x <= playerPositionX + fudgeFactor)
                    {
                        //do nothing.
                    }
                    else if (playerPositionX < transform.position.x)
                    {
                        transform.Translate(new Vector3(-1, 0) * Time.deltaTime * 180, Space.World);
                    }
                    else if (playerPositionX > transform.position.x)
                    {
                        transform.Translate(new Vector3(1, 0) * Time.deltaTime * 180, Space.World);
                    }
                }
            }
        }
        else
        {
            returning = true;
        }
    }
Ejemplo n.º 33
0
 public void OnAttackComplete()
 {
     attackPhase     = AttackPhase.Circle;
     attackFrequency = Random.Range(2, 5);
 }
Ejemplo n.º 34
0
 //called by animator
 public void Strike ()
 {
     attackPhase = AttackPhase.Striking;
 }
Ejemplo n.º 35
0
 public void StartPhase1()
 {
     Debug.Log("Start phase 1");
     this._currentAttackPhase = AttackPhase.Phase1;
 }
Ejemplo n.º 36
0
 private void EndSpin()
 {
     curPhase = AttackPhase.End;
     SelectPosition(quarter, true);
 }