Exemplo n.º 1
0
    public static void ThrowStone(CombatUnit caster, Tile targetTile, CombatUnit targetUnit)
    {
        Action action = Engine.CombatManager.ActionTable["ThrowStone"];

        Timeline t = new GameObject("Throw Stone Timeline").AddComponent <Timeline>();

        t.gameObject.AddComponent <CameraFocus_TimelineEvent>().Init(t, 0, caster.transform.position, .5f);
        t.Advance(.5f);

        t.gameObject.AddComponent <Message_TimelineEvent>().Init(t, 0, "Effect", action.GetName());
        t.Advance(.15f);

        t.gameObject.AddComponent <FaceTile_TimelineEvent>().Init(t, 0, caster.GetComponent <Facer>(), targetTile);
        t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 0, "Armature|SwordAttack", caster.GetComponentInChildren <Animator>());
        t.gameObject.AddComponent <PlaySound_TimelineEvent>().Init(t, 0, "sword_swing");
        t.Advance(.25f); // Moment of impact


        TileOccupier tO = TileOccupier.GetTileOccupant(targetTile);

        if (tO != null)
        {
            targetUnit = tO.GetComponent <CombatUnit>();

            int damage = Action.Mod2(caster.PA, false, Element.None, caster, targetUnit, System.Reflection.MethodBase.GetCurrentMethod().Name);


            targetUnit.TakeDamage(damage);

            t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 0f, "Armature|Hurt", targetUnit.GetComponentInChildren <Animator>());
            t.gameObject.AddComponent <PlaySound_TimelineEvent>().Init(t, 0, "slash");
            t.gameObject.AddComponent <SpawnEffect_TimelineEvent>().Init(t, .2f, "PhysicalDamage", targetTile);
            t.gameObject.AddComponent <FlyingText_TimelineEvent>().Init(t, .35f, damage.ToString(), targetUnit);
            t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, .55f, caster.GetDefaultAnimation(), caster.GetComponentInChildren <Animator>());
            t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, .55f, targetUnit.GetDefaultAnimation(), targetUnit.GetComponentInChildren <Animator>());
            t.Advance(.55f);
        }
        else
        {
            t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 1f, caster.GetDefaultAnimation(), caster.GetComponentInChildren <Animator>());
        }

        t.gameObject.AddComponent <DestroyTimeline_TimelineEvent>().Init(t, .25f);
        t.PlayFromStart();
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        animate();

        if (Engine.InputManager.Attach == this)
        {
            DelegatedInput();

            if (Engine.InputManager.Accept)
            {
                Engine.InputManager.Accept = false;
                TileOccupier tO = TileOccupier.GetTileOccupant(GetTile());
                if (tO)
                {
                    tO.GetComponent <CombatUnit>().ShowMenu();
                }
            }
        }
    }
Exemplo n.º 3
0
    public static void Fire(CombatUnit caster, Tile targetTile, CombatUnit targetUnit)
    {
        Action action = Engine.CombatManager.ActionTable["Fire"];

        Timeline t = new GameObject("Fire Timeline").AddComponent <Timeline>();

        t.gameObject.AddComponent <CameraFocus_TimelineEvent>().Init(t, 0, caster.transform.position, .5f);
        t.Advance(.5f);

        t.gameObject.AddComponent <Message_TimelineEvent>().Init(t, 0, "Effect", action.GetName());
        t.Advance(.15f);

        t.gameObject.AddComponent <FaceTile_TimelineEvent>().Init(t, 0, caster.GetComponent <Facer>(), targetTile);
        t.Advance(.25f); // Moment of impact

        List <Tile> affected = action.AffectedTiles(targetTile, new List <Tile>());

        foreach (Tile affectedTile in affected)
        {
            TileOccupier tO = TileOccupier.GetTileOccupant(affectedTile);
            if (tO != null)
            {
                targetUnit = tO.GetComponent <CombatUnit>();
                int damage = Action.Mod5(Element.Fire, 14, caster, targetUnit);

                targetUnit.TakeDamage(damage);

                t.gameObject.AddComponent <CameraFocus_TimelineEvent>().Init(t, 0, tO.transform.position, .25f);
                t.gameObject.AddComponent <SpawnEffect_TimelineEvent>().Init(t, .25f, "Fire", tO.GetOccupiedTile());
                t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 1.25f, "Armature|Hurt", tO.GetComponentInChildren <Animator>());
                t.gameObject.AddComponent <FlyingText_TimelineEvent>().Init(t, 2.25f, damage.ToString(), tO);
                t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 3.75f, targetUnit.GetDefaultAnimation(), targetUnit.GetComponentInChildren <Animator>());
                t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 3.75f, caster.GetDefaultAnimation(), caster.GetComponentInChildren <Animator>());
                t.Advance(3.75f);
            }
        }

        t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 0f, caster.GetDefaultAnimation(), caster.GetComponentInChildren <Animator>());
        t.gameObject.AddComponent <DestroyTimeline_TimelineEvent>().Init(t, .25f);
        t.PlayFromStart();
    }
Exemplo n.º 4
0
    public static CombatUnit TargetUnit(Tile targetTile)
    {
        TileOccupier tO = TileOccupier.GetTileOccupant(targetTile);

        return((tO != null) ? tO.GetComponent <CombatUnit>() : null);
    }