예제 #1
0
    public static void NightSword(CombatUnit caster, Tile targetTile, CombatUnit targetUnit)
    {
        string action_id = System.Reflection.MethodBase.GetCurrentMethod().Name;
        Action action    = Engine.CombatManager.ActionTable[action_id];

        Timeline t = ActionPatterns.Start(action, true);

        ActionPatterns.UseWeapon(t, caster, targetTile);

        targetUnit = ActionPatterns.TargetUnit(targetTile);
        if (targetUnit)
        {
            bool critical = Action.GetCritical();
            int  damage   = Action.Mod2(caster.PA, critical, Element.None, caster, targetUnit, action_id);

            targetUnit.TakeDamage(damage);

            t.gameObject.AddComponent <CameraFocus_TimelineEvent>().Init(t, 0, targetUnit.transform.position, .25f);
            t.gameObject.AddComponent <SpawnEffect_TimelineEvent>().Init(t, .0f, "NightSword", targetUnit.GetComponent <TileOccupier>().GetOccupiedTile());
            t.gameObject.AddComponent <PlaySound_TimelineEvent>().Init(t, 2.60f, "clang");
            t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 2.75f, "Armature|Hurt", targetUnit.GetComponentInChildren <Animator>());
            t.gameObject.AddComponent <FlyingText_TimelineEvent>().Init(t, 4.25f, damage.ToString(), targetUnit);
            t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 4.25f, targetUnit.GetDefaultAnimation(), targetUnit.GetComponentInChildren <Animator>());
            t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 5.25f, targetUnit.GetDefaultAnimation(), targetUnit.GetComponentInChildren <Animator>());
            t.gameObject.AddComponent <CameraFocus_TimelineEvent>().Init(t, 5.25f, caster.transform.position, .25f);
            t.gameObject.AddComponent <FlyingText_TimelineEvent>().Init(t, 5.75f, "+" + damage.ToString(), caster);
            t.Advance(5.75f);
        }

        t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, .25f, caster.GetDefaultAnimation(), caster.GetComponentInChildren <Animator>());
        t.gameObject.AddComponent <DestroyTimeline_TimelineEvent>().Init(t, .25f);
        t.PlayFromStart();
    }
예제 #2
0
    public static void Charge1(CombatUnit caster, Tile targetTile, CombatUnit targetUnit)
    {
        string   action_id = System.Reflection.MethodBase.GetCurrentMethod().Name;
        Action   action    = Engine.CombatManager.ActionTable[action_id];
        Timeline t         = ActionPatterns.Start(action, true);

        ActionPatterns.UseWeapon(t, caster, targetTile);

        targetUnit = ActionPatterns.TargetUnit(targetTile);
        if (targetUnit)
        {
            bool critical   = Action.GetCritical();
            bool hitSuccess = Action.HitSuccess(caster, targetUnit, 100);
            int  damage     = Action.Mod2(caster.PA, critical, Element.None, caster, targetUnit, action_id);

            if (hitSuccess)
            {
                ActionPatterns.HitDamage(t, caster, targetUnit, damage);
            }
            else
            {
                ActionPatterns.HitAvoid(t, caster, targetUnit);
            }
        }

        t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 1f, caster.GetDefaultAnimation(), caster.GetComponentInChildren <Animator>());
        t.gameObject.AddComponent <DestroyTimeline_TimelineEvent>().Init(t, .25f);
        t.PlayFromStart();
    }
예제 #3
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();
    }
예제 #4
0
 public static void HitDamage(Timeline t, CombatUnit caster, CombatUnit targetUnit, int damage)
 {
     targetUnit.TakeDamage(damage);
     t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 0f, "Armature|Hurt", targetUnit.GetComponentInChildren <Animator>());
     WeaponHitSound(t, caster);
     t.gameObject.AddComponent <SpawnEffect_TimelineEvent>().Init(t, .2f, "PhysicalDamage", targetUnit.GetComponent <TileOccupier>().GetOccupiedTile());
     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);
 }
예제 #5
0
    public static void AccessoryGuard(Timeline t, CombatUnit caster, CombatUnit targetUnit)
    {
        float targetFacing = targetUnit.transform.eulerAngles.y;

        t.gameObject.AddComponent <FaceTile_TimelineEvent>().Init(t, 0, targetUnit.GetComponent <Facer>(), caster.GetComponent <TileOccupier>().GetOccupiedTile());
        t.gameObject.AddComponent <Shimmy_TimelineEvent>().Init(t, .05f, targetUnit.gameObject);
        t.gameObject.AddComponent <FlyingText_TimelineEvent>().Init(t, .35f, "MISS", targetUnit);
        t.gameObject.AddComponent <FaceAngle_TimelineEvent>().Init(t, .55f, targetUnit.GetComponent <Facer>(), targetFacing);
        t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, .55f, caster.GetDefaultAnimation(), caster.GetComponentInChildren <Animator>());
        t.Advance(.55f);
    }
예제 #6
0
    public static void WeaponGuard(Timeline t, CombatUnit caster, CombatUnit targetUnit)
    {
        float targetFacing = targetUnit.transform.eulerAngles.y;

        t.gameObject.AddComponent <FaceTile_TimelineEvent>().Init(t, 0, targetUnit.GetComponent <Facer>(), caster.GetComponent <TileOccupier>().GetOccupiedTile());
        t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 0, "Armature|ShieldBlock", targetUnit.GetComponentInChildren <Animator>());
        t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, 0, "Armature|SwordAttackBlocked", caster.GetComponentInChildren <Animator>());
        t.gameObject.AddComponent <PlaySound_TimelineEvent>().Init(t, 0, "shield_block");
        t.gameObject.AddComponent <FlyingText_TimelineEvent>().Init(t, .35f, "GUARDED", targetUnit);
        t.gameObject.AddComponent <FaceAngle_TimelineEvent>().Init(t, .55f, targetUnit.GetComponent <Facer>(), targetFacing);
        t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, .55f, targetUnit.GetDefaultAnimation(), targetUnit.GetComponentInChildren <Animator>());
        t.gameObject.AddComponent <UnitAnimation_TimelineEvent>().Init(t, .75f, caster.GetDefaultAnimation(), caster.GetComponentInChildren <Animator>());
        t.Advance(.75f);
    }
예제 #7
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();
    }