Пример #1
0
    IEnumerator GenerateAttackAnims(UnitProxy oppUnit, GameObject baseProj, Vector3 start, Vector3 finish)
    {
        TileProxy dTile = BoardProxy.instance.GetTileAtPosition(GetPosition());

        dTile.CreateAnimation(Glossary.GetAtkFx(oppUnit.GetData().GetFactionType(), oppUnit.GetData().GetUnitType()), AnimationInteractionController.NO_WAIT);
        yield return(null);
    }
Пример #2
0
    public void EvalDeath(UnitProxy unit)
    {
        TileProxy tle = BoardProxy.instance.GetTileAtPosition(unit.GetPosition());

        tle.CreateAnimation(Glossary.fx.bloodExplosions);
        //tle.FloatUp(Skill.Actions.None,"Death", Color.red,"Character died");
        AnimationInteractionController.InteractionAnimationGameobject(
            BoardProxy.instance.glossary.GetComponent <Glossary>().skull, tle.gameObject, AnimationInteractionController.NO_WAIT, true);

        tle.RemoveGridObjectProxy(unit);
        Destroy(unit.gameObject);
        EvaluateGame();
    }
Пример #3
0
    IEnumerator WaitForZap(TileProxy newTl, TileProxy oldTl, string actStr)
    {
        yield return(new WaitForSeconds(AnimationInteractionController.ANIMATION_WAIT_TIME_LIMIT));

        newTl.ReceiveGridObjectProxy(this);
        //newTl.FloatUp(Skill.Actions.None, "whabam!", Color.blue, actStr);
        newTl.CreateAnimation(Glossary.fx.laser, 0);

        oldTl.RemoveGridObjectProxy(this);
        //oldTl.FloatUp(Skill.Actions.None, "poof", Color.cyan, actStr);
        oldTl.CreateAnimation(Glossary.fx.laser, 0);

        SetPosition(newTl.GetPosition());
        SnapToCurrentPosition();
    }
Пример #4
0
    IEnumerator GenerateProjectile(Unit.FactionType factionType, Unit.UnitType unitType, TileProxy destTile, GameObject baseProj, Vector3 start, Vector3 finish, Color projColor, bool rotate, float chargeWait,
                                   float xOffset, float yOffset, float projSpeed)
    {
        GameObject newProj = Instantiate(baseProj, start, Quaternion.identity);

        newProj.GetComponent <SpriteRenderer>().color = projColor;
        if (chargeWait > 0)
        {
            yield return(new WaitForSeconds(chargeWait));
        }
        //yield return new WaitForSeconds(chargeWait);
        iTween.MoveTo(newProj, finish, projSpeed);
        if (rotate)
        {
            iTween.RotateBy(newProj, new Vector3(0, 0, 1), projSpeed);
        }
        yield return(new WaitForSeconds(projSpeed - .1f));

        Destroy(newProj);
        destTile.CreateAnimation(Glossary.GetAtkFx(factionType, unitType), AnimationInteractionController.NO_WAIT);
        //Destroy(newProj);
    }
Пример #5
0
    public virtual IEnumerator LerpToTile(TileProxy tile, float time, bool firstTile = false)
    {
        Vector3 start = transform.position;
        Vector3 end   = BoardProxy.GetWorldPosition(tile.GetPosition());

        /*
         * Right here is where the animation needs to be set
         */
        Animator anim = transform.GetChild(0).GetComponent <Animator>();

        if (anim != null)
        {
            Vector3    theScale  = transform.localScale;
            Vector3Int animStart = GetPosition();
            Vector3Int animEnd   = tile.GetPosition();
            Vector3    diff      = animEnd - animStart;

            if (diff.x > 0)
            {
                Debug.Log("right");
                theScale.x = -1;
                anim.SetBool("IDLE_FRONT_LEFT", false);
                while (anim.GetBool("IDLE_FRONT_LEFT"))
                {
                }
                anim.SetBool("MV_BACK_LEFT", true);
                anim.SetBool("MV_FRONT_LEFT", false);
            }
            else if (diff.x < 0)
            {
                Debug.Log("left");
                theScale.x = 1;
                anim.SetBool("IDLE_FRONT_LEFT", true);
                while (!anim.GetBool("IDLE_FRONT_LEFT"))
                {
                }
                anim.SetBool("MV_BACK_LEFT", false);
                anim.SetBool("MV_FRONT_LEFT", true);
            }
            else
            {
                //Defender is right below or above attacker
                if (diff.y > 0)
                {
                    Debug.Log("up");
                    theScale.x = 1;
                    anim.SetBool("IDLE_FRONT_LEFT", false);
                    while (anim.GetBool("IDLE_FRONT_LEFT"))
                    {
                    }
                    anim.SetBool("MV_BACK_LEFT", true);
                    anim.SetBool("MV_FRONT_LEFT", false);
                }
                else if (diff.y < 0)
                {
                    Debug.Log("down");
                    theScale.x = -1;
                    anim.SetBool("IDLE_FRONT_LEFT", true);
                    while (!anim.GetBool("IDLE_FRONT_LEFT"))
                    {
                    }
                    anim.SetBool("MV_BACK_LEFT", false);
                    anim.SetBool("MV_FRONT_LEFT", true);
                }
            }
            transform.localScale = theScale;
        }
        float timer = 0f;

        while (timer < time)
        {
            //            Debug.Log(transform.position);
            transform.position = Vector3.Lerp(start, end, timer / time);
            timer += Time.deltaTime;
            yield return(0f);
        }

        data.SetPosition(tile.GetPosition());
        if (!GetData().IsDead())
        {
            tile.CreateAnimation(Glossary.fx.smoke1);
        }
        if (tile.OnFire() && !firstTile)
        {
            if (IsAttackedEnvironment(1))
            {
                transform.GetChild(0).GetComponent <SpriteRenderer>().enabled = false;
                transform.GetChild(0).GetComponent <Animator>().enabled       = false;

                //ConditionTracker.instance.EvalDeath(this);
            }
        }
        //AnimationInteractionController.InteractionAnimationGameobject(
        //BoardProxy.instance.glossary.GetComponent<Glossary>().skull, BoardProxy.instance.GetTileAtPosition(GetPosition()).gameObject, AnimationInteractionController.NO_WAIT, true);
    }