示例#1
0
    public AutoHumanoidAgentController getDroid(Vector3 position, int health, float skill)
    {
        foreach (var droid in droids)
        {
            if (!droid.isInUse())
            {
                droid.setPosition(position);
                droid.health     = health;
                droid.skillLevel = skill;

                droid.addOnDestroyEvent(OnAgentDestory);
                droid.resetCharacher();
                droid.setInUse(true);

                if (m_mobilePlayer != null)
                {
                    m_mobilePlayer.addTarget(droid.getICyberAgent());
                }

                if ((Random.value + skill > 0.95f) && Random.value > 0.5f)
                {
                    MovingAgent movingAgent = droid.getICyberAgent() as MovingAgent;

                    if (movingAgent.getCurrentWeaponType().Equals(Weapon.WEAPONTYPE.secondary))
                    {
                        movingAgent.togglePrimaryWeapon();
                    }
                }

                return(droid);
            }
        }

        return(null);
    }