public void updateDescription()
    {
        MoveSelector_Child kiddo = currentMenu.GetComponent <MoveSelector_Child>();
        int          sel         = kiddo.currentSelection;
        SelectorNode selected;

        try
        {
            selected = current.children[sel];
        }
        catch (ArgumentOutOfRangeException e)
        {
            selected = current.children[0];
        }

        if (types.ContainsKey(selected.name))
        {
            if (types[selected.name] == "move")
            {
                Move m = MoveUtils.GetMove(selected.name);
                kiddo.setDescription(m.description);
            }
            else if (types[selected.name] == "item")
            {
                Item i = (Item)selections[selected.name];
                kiddo.setDescription(i.description);
            }
        }
    }
示例#2
0
    public float MoveTo(Vector3 target, RectangleBound rectangleBound = null)
    {
        // no movement if pushed
        if (isPushed)
        {
            return(0);
        }

        float directionX = 0;
        bool  stopMoving = false;

        if (MoveUtils.TargetReachedXY(transform, target, speed, smoothTime))
        {
            // Target already reached
            stopMoving = true;
        }

        // Check if actor ist still in bounds
        if (!stopMoving && rectangleBound != null && !rectangleBound.IsInBoundX(transform.position))
        {
            stopMoving = true;
        }

        if (stopMoving)
        {
            return(0);
        }
        else if (target != Vector3.positiveInfinity)
        {
            if (transform.position.x > target.x)
            {
                directionX = -1;
            }
            if (transform.position.x < target.x)
            {
                directionX = 1;
            }
        }


        // perform moving action
        //targetPosition = Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);
        targetPosition = target - transform.position;
        targetPosition = targetPosition / targetPosition.magnitude * speed;
        if (moveSinus)
        {
            targetPosition = targetPosition + Vector3.up * (Mathf.Sin(Time.timeSinceLevelLoad * frequency) * magnitude);
        }
        return(directionX);
    }
    void Update()
    {
        if (!stopMovement)
        {
            if (!vector && MoveUtils.TargetReachedXY(transform, target, speed, 0))
            {
                // if target reached but nothing hit, destroy object
                Destroy(gameObject);
            }

            if (useTrail)
            {
                if (Time.timeSinceLevelLoad >= lastInterval + trailInterval)
                {
                    InstantiateEffect(trailPrefab, false);
                    lastInterval = Time.timeSinceLevelLoad;
                }
            }

            if (vector)
            {
                rigidb.MovePosition(transform.position + (targetPosition * speed * Time.deltaTime));
                //transform.position += targetPosition * speed * Time.deltaTime;
            }
            else
            {
                if (moveInArc)
                {
                    // Compute the next position, with arc added in
                    float x0    = startPosition.x;
                    float x1    = target.x;
                    float dist  = x1 - x0;
                    float nextX = Mathf.MoveTowards(transform.position.x, x1, speed * Time.deltaTime);
                    float baseY = Mathf.Lerp(startPosition.y, target.y, (nextX - x0) / dist);
                    float arc   = arcHeight * (nextX - x0) * (nextX - x1) / (-0.25f * dist * dist);

                    targetPosition = new Vector3(nextX, baseY + arc, transform.position.z);
                    rigidb.MovePosition(targetPosition);
                }
                else
                {
                    Vector3 newPos = Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);

                    rigidb.MovePosition(Utils.MakePixelPerfect(newPos));
                }
            }
        }
    }
示例#4
0
    void Update()
    {
        if (OnAir != anim.GetBool("OnGround"))
        {
            if (anim.GetBool("Combo" + stateName))
            {
                anim.SetBool("Combo" + stateName, false);
            }
            if (controller.GetButtonDown(key [state]))
            {
                state++;
                time = 0.5f;
                if (state == key.Length)
                {
                    if (player.gauge >= gauge && !anim.GetBool("OnStun") && !anim.GetBool("OnMove"))
                    {
                        player.gauge -= gauge;
                        anim.Play(stateName);
                        anim.SetBool("OnMove", true);
                        anim.SetBool("IgnoreGravity", true);
                        GameObject effect = Instantiate(lightEffect, effctPoint.transform.position, Quaternion.identity) as GameObject;
                        Destroy(effect, 2);
                        Player.time = 0;
                        Invoke("Return", 0.1f);
                        Debug.Log("Especial");
                    }
                    state = 0;
                    anim.SetBool("Combo" + stateName, true);
                }
            }
        }

        //@gildaswise - Código anterior está comentado no AdvanceSkill.cs
        if (time > 0)
        {
            -time -= Time.deltaTime;
            -
        }
        else
        {
            -time  = 0;
            -state = 0;
            -
        }
        -changeState = MoveUtils.verifyStateChange(anim, stateName, changeState);
    }
示例#5
0
 private void UpdatePositionsBasedOnInput()
 {
     foreach (KeyValuePair <MoveProvider, List <Move> > entry in movesPerProvider)
     {
         Move currentMove = entry.Value[currentTurn];
         if (currentMove == Move.STAY)
         {
             continue;
         }
         TileVisitor visitor = entry.Key.gameObject.GetComponent <TileVisitor>();
         Direction   moveIn  = MoveUtils.GetDirectionFor(currentMove);
         if (visitor.CurrentlyVisiting.canMove(moveIn))
         {
             animationManager.SetNewTileLocation(visitor.gameObject, visitor.CurrentlyVisiting);
             visitor.CurrentlyVisiting = visitor.CurrentlyVisiting.GetNeighbor(moveIn);
         }
     }
 }
示例#6
0
    /*
     * Name: getMoves
     * Description: Returns a list of Move objects that this PlayerCharacter is authorized to use.
     */
    public Move[] getMoves()
    {
        //TODO: Actually calculate what moves are possible.
        MoveUtils.InitMoves();
        List <string> names = new List <string>();
        List <Move>   moves = new List <Move>();

        names.Add("Bash");
        names.Add("Wrench Throw");
        names.Add("Two Handed Swing");
        names.Add("Pierce The Heart");

        /*if (weapon == "Wrench") {
         *  names.Add("Bash");
         *  if (level >= 2) {
         *      names.Add("Wrench Throw");
         *  }
         *  if (level >= 3) {
         *      names.Add("Two Handed Swing");
         *  }
         * } else if(weapon == "Fan Sword") {
         *  if (level >= 4) {
         *      names.Add("Slash");
         *      names.Add("Two Handed Swing");
         *  }
         *  if (defense >= 5) {
         *      names.Add("Pierce The Heart");
         *  }
         * } else {
         *  Debug.LogWarning("The weapon held by the PlayerCharacter script doesn't have logic!");
         * }*/

        List <string> addedMoves = new List <string>();

        foreach (string name in names)
        {
            if (!addedMoves.Contains(name))
            {
                addedMoves.Add(name);
                moves.Add(MoveUtils.GetMove(name));
            }
        }
        return(moves.ToArray());
    }
    // Use this for initialization
    void Start()
    {
        //Set the "state" string to "player" if the player should go first, "enemy" if not.
        state         = "player";
        defenseEffect = 0;
        baseDefense   = GameController.player.defense;
        //Link this controller to both fighters.
        enemy.fightController = this;
        GameController.player.fightController = this;
        //Get all moves initialized.
        MoveUtils.InitMoves();

        hasFallen = true;
        isRising  = false;

        //Get the scene active scene switcher and get the enemy from that.
        //First, get the game object then get it's controller.
        GameObject            sc  = GameObject.Find("Scene Switcher");
        SceneSwitchController ssc = null;

        animationNeeded = false;

        if (sc != null)
        {
            ssc = sc.GetComponent <SceneSwitchController>();
        }

        if (ssc != null)
        {
            Debug.Log("TEST");
            ssc.fc      = this;
            ssc.fc_go   = this.gameObject;
            passedEnemy = (Enemy)ssc.passingObject;
            Debug.Log(passedEnemy.name);
        }

        InitializeFighters();
    }
示例#8
0
    public void SpawnParitcle(ParticleEventProperties properties, bool applyOnTargetList, float startTime)
    {
        if (properties == null)
        {
            return;
        }
        if (applyOnTargetList)
        {
            SpawnParticleOnTargetList(properties, applyOnTargetList, startTime);
            return;
        }

        ParticleSystem ps = MoveUtils.InstantiateParticle(this, properties, animator);

        if (ps == null)
        {
            EB.Debug.LogWarning("ps==null ", properties.ParticleName);
            return;
        }

        ParticleCell pc = new ParticleCell(startTime, ps, properties._duration <= 0 ? ps.duration : properties._duration);

        listPC.Add(pc);
        lastTime = new float[listPC.Count];
        if (!Application.isPlaying) //不需要加载
        {
            ps.EnableEmission(false);
            ps.Stop(true);
        }
        else
        {
            pc.startTime = _time;
            pc.isPlayed  = true;
            PlayParticle(pc.ps, 0);
        }
    }
示例#9
0
    // Moves GameObject in the direction of the target. Returns direction it is heading.
    public float MoveTo(Vector3 target, RectangleBound rectangleBound = null)
    {
        bool  stopMoving = false;
        float directionX = 0;

        // Check if actor ist still in bounds
        if (rectangleBound != null && !rectangleBound.IsInBoundX(transform.position))
        {
            stopMoving = true;
        }

        // check if target is reached
        if (MoveUtils.TargetReachedX(transform, target))
        {
            stopMoving = true;
        }

        if (stopMoving)
        {
            StopMoving();
        }
        else if (target != Vector3.positiveInfinity)
        {
            if (transform.position.x > target.x)
            {
                directionX = -1;
            }
            if (transform.position.x < target.x)
            {
                directionX = 1;
            }
        }

        OnMove(directionX, 0F);
        return(directionX);
    }
示例#10
0
    public void Start()
    {
        /*if (GameController.player == null) {
         *  GameController.player = new PlayerCharacter();
         *  Debug.LogWarning("Can't find PlayerCharacter script in the scene. This may cause issues.");
         * }*/

        takeControl = true;
        Debug.Log("Player in Move Selector: " + GameController.player.strength);

        /*if(GameController.player == null) {
         *  Debug.LogWarning("There is no fighter class attached to the move selector. I'm creating a fake player for testing purposes.");
         *  GameController.player = new PlayerCharacter();
         *  GameController.player.testInventory();
         * }*/
        if (GameController.player.name == "[Test_inv]")
        {
            GameController.player.testInventory();
        }

        MoveUtils.InitMoves();

        selections = new Dictionary <string, object>();
        types      = new Dictionary <string, string>();

        selectorMap = new Dictionary <SelectorType, GameObject>();
        selectorMap[SelectorType.Loop]     = loopObject;
        selectorMap[SelectorType.Grid]     = gridObject;
        selectorMap[SelectorType.In_Place] = inPlaceObject;

        root = new SelectorNode("root", "ROOT", new List <SelectorNode>(), SelectorType.Grid);

        SelectorNode moves = new SelectorNode("moves", "Moves", new List <SelectorNode>(), SelectorType.Loop);

        root.addChild(moves);

        foreach (Move m in GameController.player.getMoves())
        {
            selections.Add(m.name, MoveUtils.GetMove(m.name));
            types.Add(m.name, "move");
            moves.addChild(new SelectorNode(m.name, m.name));
        }

        items = new SelectorNode("items", "Items", new List <SelectorNode>(), SelectorType.Loop);
        root.addChild(items);

        if (GameController.player.inventory.Count > 0)
        {
            foreach (Item item in GameController.player.inventory)
            {
                Debug.Log(item.getName());
                if (item.getName() != "Rock" && item.getName() != "Ladder")
                {
                    selections.Add(item.getName(), item);
                    types.Add(item.getName(), "item");
                    items.addChild(new SelectorNode(item.getName(), item.getDisplayName()));
                }
            }
        }



        SelectorNode options = new SelectorNode("run", "Run");

        root.addChild(options);

        SelectorNode special = new SelectorNode("special", "Special", new List <SelectorNode>(), SelectorType.Loop);

        root.addChild(special);

        current = root;

        updateDisplay();
    }
    // Update is called once per frame
    void Update()
    {
        animationNeeded = false;
        animationData   = "";
        moveName        = "";

        float jump = Input.GetAxis("Jump");

        jumpFrame = false;



        if (jump > 0 && oldJump == 0 && moveSelector != null && !moveSelector.GetComponent <MoveSelector>().takeControl)
        {
            jumpFrame = true;
        }

        oldJump = jump;

        //  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        // |                                                                      |
        // |   If you're looking for the state machine process, it's right here.  |
        // |                                                                      |
        //  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        if (state == "player")
        {
            //See if the player has selected a move by getting the string and then seeing if it's null.
            string selectedMove = GameController.player.getSelectedMove(true);
            if (selectedMove != null)
            {
                moveSelector.GetComponent <MoveSelector>().takeControl = false;
                //Check if the player has enough stamina for this move.
                Move m = MoveUtils.GetMove(selectedMove);

                if (m.moveEligible(GameController.player))
                {
                    // Check if player stats need to be changed this turn
                    if (defenseEffect - 1 > 0)
                    {
                        defenseEffect -= 1;
                    }
                    else
                    {
                        // Reset defense
                        GameController.player.defense = baseDefense;
                    }

                    //This block runs when the player has selected a move. Run any logic needed to process the move.

                    string status = processMove(GameController.player, enemy, selectedMove);
                    string prefix = "";
                    if (selectedMove != Constants.ItemUse && selectedMove != Constants.Stunned && selectedMove != "Run")
                    {
                        prefix = "You used " + selectedMove + "! ";
                    }

                    setStatus(prefix + status);
                    //Set the state to display_wait to allow the player time to read what's happened.
                    state = "display_wait";
                    if (runAnimation)
                    {
                        animationNeeded = true;
                        if (m.animateAttacker)
                        {
                            animationData = "player_buff";
                        }
                        else if (m.animateDefender)
                        {
                            animationData = "enemy_damage";
                        }
                        moveName = selectedMove;
                    }

                    waitStart = Time.time;
                    if (selectedMove == "Run")
                    {
                        gameOver  = true;
                        exitState = "run";
                    }
                    if (gameOver)
                    {
                        nextState = "end";
                    }
                    else
                    {
                        nextState = "enemy";
                    }
                }
                else
                {
                    setStatus("You don't have enough stamina!");

                    //Set the state to display_wait.
                    state     = "display_wait";
                    waitStart = Time.time;
                    nextState = "player";
                }
            }
        }

        if (state == "enemy")
        {
            //Have the enemy player run it's logic.
            string selectedMove = enemy.getMove();
            string status       = processMove(enemy, GameController.player, selectedMove);

            Move m = MoveUtils.GetMove(selectedMove);

            if (selectedMove == Constants.Stunned || selectedMove == "NoStamina")
            {
                setStatus(status);
            }
            else
            {
                setStatus("The enemy used " + selectedMove + "! " + status);
            }

            //Set the state to display_wait to allow the player time to read what's happened.
            state = "display_wait";

            if (runAnimation)
            {
                animationNeeded = true;
                if (m.animateAttacker)
                {
                    animationData = "enemy_buff";
                }
                else if (m.animateDefender)
                {
                    animationData = "player_damage";
                }
                moveName = selectedMove;
            }


            waitStart = Time.time;
            if (gameOver)
            {
                nextState = "end";
            }
            else
            {
                nextState = "player";
            }
        }

        if (state == "display_wait")
        {
            if (Time.time >= waitStart + waitTime)
            {
                state = nextState;

                if (nextState == "player")
                {
                    moveSelector.GetComponent <MoveSelector>().takeControl = true;
                }
            }

            if (jumpFrame)
            {
                state = nextState;

                if (nextState == "player")
                {
                    moveSelector.GetComponent <MoveSelector>().takeControl = true;
                }
            }
        }

        if (state == "end")
        {
            setStatus(finalStatus);

            if (jumpFrame)
            {
                //The player is ready to leave the fight.
                DontDestroyOnLoad(this.gameObject);
                state = "post-fight";

                if (nextScene == "TitleScreen")
                {
                    //Destroy ALL gameobjects.
                    foreach (GameObject o in Object.FindObjectsOfType <GameObject>())
                    {
                        if (o != this.gameObject)
                        {
                            Destroy(o);
                        }
                    }
                    SceneManager.LoadScene(nextScene);
                }
            }
        }

        if (state != "post-fight")
        {
            updateUI();
        }
    }
    string processMove(Fighter attack, Fighter defend, string move)
    {
        runAnimation = false;

        // Check if attacker is stunned
        if (move == Constants.Stunned)
        {
            return(attack.name + " is stunned!");
        }

        if (move == Constants.ItemUse)
        {
            return("You used an item!");
        }

        if (move == "NoStamina")
        {
            return(attack.name + " has no stamina!");
        }

        if (move == "Run")
        {
            return("You ran from the fight!");
        }

        //Get the move from the move name.
        Move moveObj = MoveUtils.GetMove(move);
        Dictionary <string, int> moveData = moveObj.processMove(attack, defend);

        //Apply effects to attacker/defender.



        if (moveData.ContainsKey(Constants.HP))
        {
            int damage = moveData[Constants.HP];

            if (defend.invulnerable == 0)
            {
                if (defend.defense <= 4)
                {
                    defend.takeDamage(damage);
                }
                else if (5 <= enemy.defense && enemy.defense <= 9)
                {
                    defend.takeDamage(damage - 1);
                }
                else if (10 <= enemy.defense && enemy.defense <= 19)
                {
                    defend.takeDamage(damage - 2);
                }
                else
                {
                    defend.takeDamage(damage - 3);
                }

                runAnimation = true;
            }
        }
        if (moveData.ContainsKey(Constants.GuaranteedHP))
        {
            int damage = moveData[Constants.GuaranteedHP];
            defend.takeDamage(damage);

            runAnimation = true;
        }

        if (moveData.ContainsKey(Constants.Heal))
        {
            int amt = moveData[Constants.Heal];
            attack.heal(amt);

            runAnimation = true;
        }


        if (moveData.ContainsKey(Constants.Stunned))
        {
            int turns = moveData[Constants.Stunned];
            for (int i = 0; i < turns; ++i)
            {
                // Will add "Stunned" move to defender move queue for i turns
                defend.addSelectedMove(Constants.Stunned);
            }
        }



        if (moveData.ContainsKey(Constants.DefenseEffect))
        {
            defenseEffect += moveData[Constants.DefenseEffect];
        }

        if (moveData.ContainsKey(Constants.Invulnerability))
        {
            attack.invulnerable += moveData[Constants.Invulnerability];

            runAnimation = true;
        }



        //Calculate damage string here.

        if (defend.invulnerable > 0)
        {
            defend.invulnerable--;
        }


        return("");
    }
示例#13
0
    /// <summary>
    /// 初始化 优先级低于Spawn
    /// </summary>
    public void Init(Transform[] tars = null)
    {
        if (characterTran != null && characterTran.GetComponent <Animator>() != null)
        {
            transform.parent = MoveUtils.GetBodyPartTransform(characterTran.GetComponent <Animator>(), bodyPart, spawnCustomPath);
        }
        else
        {
            EB.Debug.LogError("[NullReferenceException] ProjectileMono.Init: line 88");
        }

        transform.localPosition = Vector3.zero;
        transform.position     += offset; //非常省事
        transform.parent        = null;
        Reset();

        if (isTarget)
        {
            if (Application.isPlaying)
            {
                //Combatant cb = characterTran.GetComponent<Combatant>();
                //if (cb != null&& cb.LTTargets!=null)
                //{
                //    Combatant[] tcbs = new Combatant[cb.LTTargets.Count];
                //    for (int i = 0; i < tcbs.Length; i++)
                //    {
                //        tcbs[i] = LTCombatEventReceiver.Instance.GetCombatant(cb.LTTargets[i]);
                //    }
                //    if (targets == null || targets.Length != tcbs.Length)
                //    {
                //        targets = new Transform[tcbs.Length];
                //    }
                //    for (int i = 0; i < tcbs.Length; i++)
                //    {
                //        targets[i] = tcbs[i].transform;
                //    }

                //    mainTarget = targets[0];//运行时 默认暂定为第0个下标的 为主要点选对象
                //}

                if (tars != null && tars.Length > 0)
                {
                    targets    = tars;
                    mainTarget = targets[0];//运行时 默认暂定为第0个下标的 为主要点选对象
                }
            }
        }

        if (targets != null)
        {
            if (targetBodyPart == BodyPart.Root)
            {
                hitTargets = targets;
            }
            else
            {
                hitTargets = new Transform[targets.Length];
                for (int i = 0; i < targets.Length; i++)
                {
                    if (targets[i] != null && targets[i].GetComponent <Animator>() != null)
                    {
                        hitTargets[i] = MoveUtils.GetBodyPartTransform(targets[i].GetComponent <Animator>(), targetBodyPart, targetCustomPath);
                    }
                    else
                    {
                        EB.Debug.LogError("[NullReferenceException] ProjectileMono.Init: line 145");
                    }
                }
            }
        }

        if (isOnly)
        {
            if (targetBodyPart == BodyPart.Root)
            {
                hitMainTarget = mainTarget;
            }
            else
            {
                if (mainTarget != null && mainTarget.GetComponent <Animator>() != null)
                {
                    hitMainTarget = MoveUtils.GetBodyPartTransform(mainTarget.GetComponent <Animator>(), targetBodyPart, targetCustomPath);
                }
                else
                {
                    EB.Debug.LogError("[NullReferenceException] ProjectileMono.Init: line 165");
                }
            }
        }

        if (isTarget && targets != null)
        {
            if (isOnly)
            {
                _tagetPoints    = new Vector3[1];
                _tagetPoints[0] = hitMainTarget.position;
                _effects        = new GameObject[1];
                _playeds        = new bool[1];
                //从对象池里拿
                ParticleSystem ps = PSPoolManager.Instance.Use(this, effectPrefab.name);
                if (ps != null)
                {
                    _effects[0] = ps.gameObject;
                    ps.gameObject.transform.parent = this.transform;
                }
                if (_effects[0] == null)
                {
                    _effects[0] = Instantiate(effectPrefab);
                }

                _particleSystems    = new ParticleSystem[1];
                effectTimes         = new float[_particleSystems.Length];
                _particleSystems[0] = _effects[0].GetComponent <ParticleSystem>();
                if (_particleSystems[0] == null)
                {
                    _particleSystems[0] = _effects[0].GetComponentInChildren <ParticleSystem>();
                }
                if (_particleSystems[0] != null)
                {
                    _particleSystems[0].transform.position = transform.position;
                }
            }
            else
            {
                _tagetPoints = new Vector3[hitTargets.Length];

                _effects         = new GameObject[hitTargets.Length];
                _playeds         = new bool[hitTargets.Length];
                _particleSystems = new ParticleSystem[hitTargets.Length];
                effectTimes      = new float[_particleSystems.Length];

                for (int i = 0; i < _tagetPoints.Length; i++)
                {
                    if (hitTargets[i] != null)
                    {
                        _tagetPoints[i] = hitTargets[i].transform.position;
                    }
                    else
                    {
                        EB.Debug.LogError("[NullReferenceException] ProjectileMono.Init: line 219");
                    }

                    //从对象池里拿
                    ParticleSystem ps = PSPoolManager.Instance.Use(this, effectPrefab.name);
                    //ParticleSystem ps = Instantiate(effectPrefab).GetComponent<ParticleSystem>();
                    if (ps != null)
                    {
                        _effects[i] = ps.gameObject;
                        ps.gameObject.transform.parent = this.transform;
                    }
                    if (_effects[i] == null)
                    {
                        _effects[i] = Instantiate(effectPrefab);
                    }
                    _particleSystems[i] = _effects[i].GetComponent <ParticleSystem>();
                    if (_particleSystems[i] == null)
                    {
                        _particleSystems[i] = _effects[i].GetComponentInChildren <ParticleSystem>();
                    }
                    if (_particleSystems[i] != null)
                    {
                        _particleSystems[i].transform.position = transform.position;
                    }
                }
            }
        }
        else //演示为无目标
        {
            _tagetPoints    = new Vector3[1];
            _tagetPoints[0] = characterTran.forward * speed * flyTime + transform.position;
            _effects        = new GameObject[1];
            _playeds        = new bool[1];

            //从对象池里拿
            ParticleSystem ps = PSPoolManager.Instance.Use(this, effectPrefab.name);
            if (ps != null)
            {
                _effects[0] = ps.gameObject;
                ps.gameObject.transform.parent = this.transform;
            }
            if (_effects[0] == null)
            {
                _effects[0] = Instantiate(effectPrefab);
            }
            //
            _particleSystems    = new ParticleSystem[1];
            effectTimes         = new float[_particleSystems.Length];
            _particleSystems[0] = _effects[0].GetComponent <ParticleSystem>();
            if (_particleSystems[0] == null)
            {
                _particleSystems[0] = _effects[0].GetComponentInChildren <ParticleSystem>();
            }
            if (_particleSystems[0] != null)
            {
                _particleSystems[0].transform.position = transform.position;
            }
        }
    }