コード例 #1
0
    public override void Exit()
    {
        // re-activate all entities
        foreach (var entity in Finder.GetEntityManager().GetUnderlings())
        {
            if (entity.GetLeader() == Finder.GetPlayer())
            {
                entity.gameObject.SetActive(true);
            }
            else // only render enemies -> deactivate all behaviors
            {
                foreach (var component in entity.GetComponents <Behaviour>())
                {
                    component.enabled = true;
                }
            }
        }
        foreach (var entity in Finder.GetEntityManager().GetDeadUnderlings())
        {
            entity.gameObject.SetActive(true);
        }

        // delete proxies
        foreach (var proxyObject in m_proxyObjects)
        {
            Object.Destroy(proxyObject);
        }
        m_proxyObjects = null;

        // delete grid slot objects
        foreach (var slotObject in m_gridSlotObjects)
        {
            Object.Destroy(slotObject);
        }
        m_gridSlotObjects = null;

        var cameraOrbitScript = Finder.GetCameraOrbitScript();

        Finder.GetOrthoPerspectiveSwitcher().SwitchToPerspective();
        cameraOrbitScript.AreControlsEnabled = true;
        cameraOrbitScript.LocalRotation      = m_originalOrbitRotation;

        // update formation collider size
        FollowSquad.UpdateFormationBoundingBox(Finder.GetPlayer());

        base.Exit();
    }
コード例 #2
0
    public virtual void Resurect()
    {
        // todo. update animation info
        gameObject.GetComponent <AnimationInfo>().SwitchModel();
        gameObject.GetComponent <AnimationInfo>().Resurect();
        m_isFriendly      = true;
        m_isHostile       = false;
        m_formationLeader = Finder.GetPlayer();
        var formationConfiguration = m_formationLeader.GetComponent <LeaderOverlord>().GetFormationConfiguration();
        var slotPos = formationConfiguration.GetEmptyFormationSlot();

        SetFormationSlot(slotPos);
        formationConfiguration.AddUnderlingEntity(this);
        m_healthPoints = 100;
        GetComponent <NavMeshAgent>().enabled = true;
        SetCurrentState <SeekFormationSlotPositionState>();

        // update formation collider size
        FollowSquad.UpdateFormationBoundingBox(Finder.GetPlayer());
    }