//Called from the PlayerInput scripts and / or the Ally button OnClick() event
    public void SummonAlly()
    {
        //If there is no ally manager, leave
        if (allyManager == null)
        {
            return;
        }
        //Attempt to get an Ally by calling SummonAlly()
        Ally ally = allyManager.SummonAlly();

        //If SummonAlly() was able to spawn an ally...
        if (ally != null)
        {
            //...set the ally as the target of the enemies...
            EnemyTarget = ally.transform;
            //...and call UnsummonAlly() after a set delay
            Invoke("UnSummonAlly", ally.Duration);
        }
    }
Esempio n. 2
0
    //从PlayerInput脚本和/或“ Ally”按钮的OnClick()事件调用
    //Called from the PlayerInput scripts and / or the Ally button OnClick() event
    public void SummonAlly()
    {
        //如果没有盟友管理员,请离开
        //If there is no ally manager, leave
        if (allyManager == null)
        {
            return;
        }
        //通过调用SummonAlly()尝试获得盟友
        //Attempt to get an Ally by calling SummonAlly()
        Ally ally = allyManager.SummonAlly();

        //如果SummonAlly()能够产生盟友...
        //If SummonAlly() was able to spawn an ally...
        if (ally != null)
        {
            // ...将盟友设为敌人的目标...
            //...set the ally as the target of the enemies...
            EnemyTarget = ally.transform;
            // ...并在设置的延迟后调用UnsummonAlly()
            //...and call UnsummonAlly() after a set delay
            Invoke("UnSummonAlly", ally.Duration);
        }
    }