Ejemplo n.º 1
0
    public void Start()
    {
        if (attackedOne == null)
        {
            ArrayList points = AttRange.GetRangeByAttType(skillConfig.attack_type, this.skillConfig.range, this.attackOne.GetAttribute().volume, this.attackOne.GetPoint(), this.attackOne.GetDirection());

            for (int i = 0; i < points.Count; i++)
            {
                ArrayList gameObjects = BattleControllor.GetGameObjectsByPosition((Vector2)points[i]);

                for (int j = 0; j < gameObjects.Count; j++)
                {
                    Charactor c = (Charactor)gameObjects[j];

                    if (c.IsActive() == true && c.GetType() != attackOne.GetType())
                    {
                        this.attackedOne = c;
                    }
                }
            }
        }

        if (attackedOne != null)
        {
            attackOne.PlayAttack();
        }
        else
        {
            end = true;
        }
    }
Ejemplo n.º 2
0
    private void TryNormalAttack()
    {
        if (normalSkillCD > 0)
        {
            normalSkillCD -= Time.deltaTime;
            return;
        }

        if (this.charModel.currentState == CharModel.State.ATTACK)
        {
            return;
        }


        ArrayList points = AttRange.GetRangeByAttType(normalAttackSkill.attack_type, this.normalAttackSkill.range, this.attribute.volume, this.position, this.currentDirection);

        for (int i = 0; i < points.Count; i++)
        {
            ArrayList gameObjects = BattleControllor.GetGameObjectsByPosition((Vector2)points[i]);

            for (int j = 0; j < gameObjects.Count; j++)
            {
                Charactor c = (Charactor)gameObjects[j];

                if (c.IsActive() == false)
                {
                    continue;
                }

                if (normalAttackSkill.target > 2)
                {
                    if (c.GetType() == this.GetType())
                    {
                        normalSkillCD = normalAttackSkill.cd;

                        normalAttackSkill.crit = attribute.crit;
                        SkillManager.PlaySkill(this, normalAttackSkill, c);
                        return;
                    }
                }
                else
                {
                    if (c.GetType() != this.GetType())
                    {
                        normalSkillCD = normalAttackSkill.cd;

                        normalAttackSkill.crit = attribute.crit;
                        SkillManager.PlaySkill(this, normalAttackSkill, c);
                        return;
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
    public void Start()
    {
        this.attackOne.PlaySkillAttack();
        this.attackOne.SetPlayLock(true);


        Vector2   v         = BattleUtils.PositionToGrid(attackOne.transform.position.x, attackOne.transform.position.y);
        Attribute attribute = attackOne.GetAttribute();
        ArrayList r         = AttRange.GetRangeByAttType(skillConfig.attack_type, skillConfig.range, attribute.volume, v, attackOne.GetDirection());

        this.range = new ArrayList();

        for (int i = 0; i < 20; i++)
        {
            int index = Random.Range(0, r.Count);

            v = (Vector2)r[index];

            if (v.x >= BattleControllor.h || v.x < 0 || v.y >= BattleControllor.v || v.y < 0)
            {
                i--;
                continue;
            }

            if (range.Contains(v))
            {
                continue;
            }

            range.Add(v);
        }

        r = null;

        alertBlocks = new ArrayList();

        for (int i = 0; i < range.Count; i++)
        {
            GameObject gameObject = (GameObject)MonoBehaviour.Instantiate(AlertBlock_pre);
            gameObject.transform.position = BattleUtils.GridToPosition((Vector2)range[i]);

            alertBlocks.Add(gameObject);
        }
    }
Ejemplo n.º 4
0
    public void Start()
    {
        this.attackOne.PlaySkillAttack();
        this.attackOne.SetPlayLock(true);

        Vector2   v         = BattleUtils.PositionToGrid(attackOne.transform.position.x, attackOne.transform.position.y);
        Attribute attribute = attackOne.GetAttribute();

        range = AttRange.GetRangeByAttType(skillConfig.attack_type, skillConfig.range, attribute.volume, v, attackOne.GetDirection());


        alertBlocks = new ArrayList();

        for (int i = 0; i < range.Count; i++)
        {
            GameObject gameObject = (GameObject)MonoBehaviour.Instantiate(AlertBlock_pre);
            gameObject.transform.position = BattleUtils.GridToPosition((Vector2)range[i]);

            alertBlocks.Add(gameObject);
        }
    }
Ejemplo n.º 5
0
    public PointFlyAttackSkill(Charactor attackOne, SkillConfig skillConfig)
    {
        this.attackOne = attackOne;

        ArrayList points = AttRange.GetRangeByAttType(skillConfig.attack_type, skillConfig.range, attackOne.GetAttribute().volume, attackOne.GetPoint(), attackOne.GetDirection());

        for (int i = 0; i < points.Count; i++)
        {
            ArrayList objects = BattleControllor.GetGameObjectsByPosition((Vector2)points[i]);

            for (int j = 0; j < objects.Count; j++)
            {
                Charactor c = objects[j] as Charactor;

                if (c.GetType() != this.attackOne.GetType() && c.IsActive() == true)
                {
                    this.attackedOne = objects[j] as Charactor;
                    break;
                }
            }
        }

        if (attackedOne == null)
        {
            this.end = true;
            return;
        }

        this.attackTransfrom   = this.attackOne.transform;
        this.attackedTransfrom = this.attackedOne.transform;

        this.skillConfig = skillConfig;

        attackOff   = new Vector3((attackOne.GetAttribute().volume / 2.0f - 0.5f) * Constance.GRID_GAP, (attackOne.GetAttribute().volume / 2.0f - 0.5f) * Constance.GRID_GAP, 0);
        attackedOff = new Vector3((attackedOne.GetAttribute().volume / 2.0f - 0.5f) * Constance.GRID_GAP, (attackedOne.GetAttribute().volume / 2.0f - 0.5f) * Constance.GRID_GAP, 0);
    }
Ejemplo n.º 6
0
    public void Update()
    {
        if (Constance.SPEC_RUNNING == false && Constance.RUNNING == false)
        {
            return;
        }
        else if (Constance.SPEC_RUNNING == true && this.specSign == false)
        {
            return;
        }

        if (end == true)
        {
            return;
        }


        if (this.attackOne.IsInAttIndex() == true && attacked == false)
        {
            Vector2 v = BattleUtils.PositionToGrid(attackOne.transform.position.x, attackOne.transform.position.y);

            Attribute attribute = attackOne.GetAttribute();

            MoveDirection direction = attackOne.GetDirection();

            ArrayList range = AttRange.GetRangeByAttType(skillConfig.attack_type, skillConfig.range, attribute.volume, v, direction);

            GameObject gameObject = (GameObject)MonoBehaviour.Instantiate(SkillObject_pre);

            skillObject      = gameObject.GetComponent <SkillObject>();
            skillObject.res  = this.skillConfig.res;
            skillObject.loop = 1;

            skillObject.transform.position = attackOne.transform.position;

            switch (direction)
            {
            case MoveDirection.DOWN:
                skillObject.SetSpriteEulerAngles(new Vector3(0, 0, 270));
                break;

            case MoveDirection.UP:
                skillObject.SetSpriteEulerAngles(new Vector3(0, 0, 90));
                break;

            case MoveDirection.LEFT:
                skillObject.SetSpriteEulerAngles(new Vector3(0, 0, 180));
                break;

            case MoveDirection.RIGHT:
                break;
            }


            for (int i = 0; i < range.Count; i++)
            {
                ArrayList objects = BattleControllor.GetGameObjectsByPosition((Vector2)range[i]);

                for (int j = 0; j < objects.Count; j++)
                {
                    Charactor c = objects[j] as Charactor;

                    if (c.GetType() != this.attackOne.GetType() && c.IsActive() == true)
                    {
                        bool  crit   = BattleControllor.Crit(skillConfig.crit);
                        float damage = BattleControllor.Attack(attackOne.GetAttribute(), c.GetAttribute(), skillConfig.demageratio, skillConfig.b, crit);

                        c.ChangeHP(damage, crit);

                        if (c.GetAttribute().hp > 0)
                        {
                            c.PlayAttacked();
                        }
                        else
                        {
                            c.PlayDead();
                        }
                    }
                }
            }

            attacked = true;
        }

        if (attacked == false)
        {
            return;
        }



        if (skillObject.IsSpritePlayEnd() == true)
        {
            MonoBehaviour.Destroy(skillObject.gameObject);

            end = true;
        }
    }