Пример #1
0
    /// <summary>
    /// Moves the permanent based on its movement stats
    /// </summary>
    /// <param name="permanent">Permanent to make move</param>
    private static void Move(CreatureStats permanent)
    {
        MapPosition from = permanent.GridPosition;

        permanentMap[permanent.GridPosition.x, permanent.GridPosition.y] = null;

        MapPosition to = permanent.GetForward();

        permanentMap[to.x, to.y] = permanent;
        permanent.GridPosition   = to;

        permanent.GetComponent <Animator>().SetBool("IsWalking", true);

        // Move it and set animating state
        LeanTween.move(permanent.gameObject, GridToWorld(to), AnimationMoveDuration).
        setOnComplete(() =>
        {
            if (!permanent)
            {
                return;
            }
            permanent.GetComponent <Animator>().SetBool("IsWalking", false);
        });

        StateManager.RegisterAnimation(AnimationMoveDuration);
        //permanent.transform.position = GridToWorld(to);

        EventManager.InvokePermanentMoved(permanent, from, to);
    }
Пример #2
0
    public void Spawn(int amount)
    {
        for (int i = 0; i < amount; i++)
        {
            int           j           = Random.Range(0, spawnPoints.Length);
            CreatureStats newCreature = Instantiate(creature, spawnPoints[j].transform.position, Quaternion.identity);
            newCreature.GetComponent <CreatureStats>().SetHomeColony(this.gameObject.GetComponent <Colony>());

            newCreature.GetComponent <SearchFromColony>().StartSearch();
        }
    }
Пример #3
0
    private void DamageSystem_OnDeathPlayer(CreatureStats c, IDamage damage)
    {
        _allPlayers.Remove(c);

        c.gameObject.tag   = "DeathPlayer";
        c.gameObject.layer = 2;
        c.GetComponent <CharacterController>().enabled = false;

        //Удаляем все состояния
        ICharacterState[] states = c.GetComponents <ICharacterState>();
        foreach (var state in states)
        {
            Destroy(state);
        }

        if (_currentPlayer == c)
        {
            ChangePlayer();
        }

        //Заплатк адля конца
        if (_allPlayers.FirstOrDefault(x => x.team == 1) == null)
        {
            endPoint.SetActive(true);
        }
    }
Пример #4
0
    public bool CheckAttack(CreatureStats from, CreatureStats to)
    {
        AttackAction action = from.GetComponent <AttackAction>();

        action.Init(to);
        return(action.Check());
    }
Пример #5
0
 private void DoTurn()
 {
     DurationLeft--;
     if (DurationLeft <= 0)
     {
         owner.GetComponent <EffectHolder>().RemoveEffect(this);
     }
 }
Пример #6
0
 private void OnTurn()
 {
     _duration--;
     if (_duration <= 0)
     {
         ownerStats.GetComponent <EffectHolder>().RemoveEffect(this);
     }
 }
Пример #7
0
        public void OnUseCard(Owner caster, MapPosition target)
        {
            CreatureStats creature = CombatManager.GetCreatureAt(target);

            if (creature != null)
            {
                creature.GetComponent <EffectHolder>().RemoveAllEffects();
            }
        }
Пример #8
0
    public void OnUseCard(Owner caster, MapPosition target)
    {
        CreatureStats creature = CombatManager.GetCreatureAt(target);

        if (creature)
        {
            FuryBuff buff = new FuryBuff();
            creature.GetComponent <EffectHolder>().AddEffect(buff);
        }
    }
Пример #9
0
        public void OnUseCard(Owner caster, MapPosition target)
        {
            CreatureStats creature = CombatManager.GetCreatureAt(target);

            if (creature != null)
            {
                SleepDebuff debuff = new SleepDebuff(3);
                creature.GetComponent <EffectHolder>().AddEffect(debuff);
            }
        }
Пример #10
0
        private void OnTurn(CreatureStats creature)
        {
            if (creature != ownerStats)
            {
                return;
            }

            DurationLeft--;
            if (DurationLeft <= 0)
            {
                ownerStats.GetComponent <EffectHolder>().RemoveEffect(this);
            }
        }
Пример #11
0
    private void StealFrom(CreatureStats creature)
    {
        bool stolenAttack = creature.Attack >= 1;


        ZombieKingDebuff debuff = new ZombieKingDebuff(stolenAttack);

        creature.GetComponent <EffectHolder>().AddEffect(debuff);

        ZombieKingBuff buff = new ZombieKingBuff(stolenAttack);

        OwnerEffects.AddEffect(buff);
    }
Пример #12
0
    private static void Attack(CreatureStats permanent)
    {
        CreatureStats enemy  = permanent.GetAttackTarget();
        Damage        damage = new Damage(permanent.Attack, DamageType.Physical);

        enemy.TakeDamage(new Source(creature: permanent), damage);

        permanent.GetComponent <Animator>().Play("Attack");
        StateManager.RegisterAnimation(AnimationAttackDuration);

        EventManager.InvokeCreatureAttack(permanent, enemy, damage);
        EventManager.InvokeCreatureAttacked(enemy, permanent);
    }
Пример #13
0
    private void OnTurn(CreatureStats creature)
    {
        if (creature != ownerStats)
        {
            return;
        }

        DurationLeft--;
        if (DurationLeft <= 0)
        {
            ownerStats.GetComponent <EffectHolder>().RemoveEffect(this);
        }

        creature.TakeDamage(new Source(creature), new Damage(3, DamageType.True));
    }
Пример #14
0
    private bool CheckInputPlayer(CreatureStats obj)
    {
        if (obj == null)
        {
            obj = MatchSystem.instance.GetActivePlayer();
        }

        AIScript ai = obj.GetComponent <AIScript>();

        if (ai != null && ai.isActiveAndEnabled)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }