コード例 #1
0
ファイル: S2001.cs プロジェクト: winneter/BigHero
    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;
        }

        singTime -= Time.deltaTime;

        if (singTime > 0)
        {
            return;
        }

        while (alertBlocks.Count > 0)
        {
            GameObject gameObject = alertBlocks[0] as GameObject;
            MonoBehaviour.Destroy(gameObject);

            alertBlocks.RemoveAt(0);
        }


        if (this.attackOne.IsInAttIndex() == true && attacked == false)
        {
            Attribute attribute = attackOne.GetAttribute();

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

            skillObject      = gameObject.GetComponent <SkillObject>();
            skillObject.res  = 6;
            skillObject.loop = 1;
            skillObject.spriteAnimation.renderer.sortingLayerID = 3;
            skillObject.transform.position = attackOne.transform.localPosition;
            skillObject.sound = 5;

            skillObject.transform.localScale = new Vector2(skillConfig.range / 16f, attribute.volume / 4f);

            switch (attackOne.GetDirection())
            {
            case MoveDirection.DOWN:
                skillObject.SetSpriteEulerAngles(new Vector3(0, 0, 270));
                skillObject.transform.position += new Vector3(0, -0.2f, 0);
                break;

            case MoveDirection.UP:
                skillObject.SetSpriteEulerAngles(new Vector3(0, 0, 90));
                skillObject.transform.position += new Vector3(0, 0.2f, 0);
                break;

            case MoveDirection.LEFT:
                skillObject.SetSpriteEulerAngles(new Vector3(0, 0, 180));
                skillObject.transform.position += new Vector3(-0.2f, 0.2f, 0);
                break;

            case MoveDirection.RIGHT:
                skillObject.transform.position += new Vector3(0.2f, 0.2f, 0);
                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);
            this.attackOne.SetPlayLock(false);
            end = true;
        }
    }
コード例 #2
0
ファイル: S2004.cs プロジェクト: winneter/BigHero
    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;
        }


        singTime -= Time.deltaTime;

        if (singTime > 0)
        {
            return;
        }


        while (alertBlocks.Count > 0)
        {
            GameObject gameObject = alertBlocks[0] as GameObject;
            MonoBehaviour.Destroy(gameObject);

            alertBlocks.RemoveAt(0);
        }



        if (this.attackOne.IsInAttIndex() == true && attacked == false)
        {
            Attribute attribute = attackOne.GetAttribute();

            for (int i = 0; i < range.Count; i++)
            {
                GameObject gameObject = (GameObject)MonoBehaviour.Instantiate(SkillObject_pre);

                SkillObject skillObject = gameObject.GetComponent <SkillObject>();
                skillObject.res  = 8;
                skillObject.loop = 1;
                skillObject.transform.localScale = new Vector3(0.5f, 0.5f, 0);

                skillObject.sound = 2;

                skillObject.transform.position = BattleUtils.GridToPosition((Vector2)range[i]);

                skillObjects.Add(skillObject);

                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 (attacked == false)
        {
            return;
        }

        for (int i = 0; i < skillObjects.Count; i++)
        {
            SkillObject skillObject = skillObjects[i] as SkillObject;

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

                skillObjects.Remove(skillObjects);

                end = true;
                this.attackOne.SetPlayLock(false);
            }
        }
    }
コード例 #3
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;
        }
    }