예제 #1
0
        public void ActivateGhost()
        {
            if (mActivating | mDeactivating)
            {
                return;
            }

            Activated = true;

            if (mSpeakingCharacter == null || mSpeakingCharacter.IsDestroyed)
            {
                if (mCharacterSpawnPoint == null)
                {
                    WorldChunk      c = worlditem.Group.GetParentChunk();
                    ActionNodeState actionNodeState = null;
                    string          nodeName        = worlditem.FileName + "GhostNode";
                    if (!c.GetOrCreateNode(worlditem.Group, worlditem.tr, worlditem.FileName + "GhostNode", out actionNodeState))
                    {
                        Debug.LogError("Couldn't create spawn node " + nodeName + " in ghost to create character");
                        return;
                    }
                    actionNodeState.actionNode.transform.position = worlditem.tr.position;
                    actionNodeState.CustomConversation            = State.CharacterConversation;
                    if (!Characters.GetOrSpawnCharacter(actionNodeState.actionNode, State.CharacterName, worlditem.Group, out mSpeakingCharacter))
                    {
                        Debug.LogError("Couldn't spawn character " + State.CharacterName + " in ghost");
                    }
                    else
                    {
                        mSpeakingCharacter.worlditem.ActiveState       = WIActiveState.Visible;
                        mSpeakingCharacter.worlditem.ActiveStateLocked = true;
                        Debug.Log("Setting character's conversation name to " + State.CharacterConversation);
                        //we don't need motile for this character
                        Motile m = null;
                        if (mSpeakingCharacter.worlditem.Is <Motile> (out m))
                        {
                            m.Finish();
                        }
                        mSpeakingCharacter.Ghost = true;
                        mSpeakingCharacter.Body.OnSpawn(mSpeakingCharacter);
                    }
                }
            }

            if (mSpeakingCharacter != null)
            {
                Talkative t = mSpeakingCharacter.worlditem.Get <Talkative> ();
                t.State.ConversationName = State.CharacterConversation;
                t.State.DefaultToDTS     = false;
                //don't show the body until we're sure it has its materials
                mSpeakingCharacter.Body.SetVisible(false);
                mSpeakingCharacter.Body.IgnoreCollisions(true);
                mSpeakingCharacter.Body.LockVisible = true;
                mActivating = true;
                StartCoroutine(ActivateOverTime());
                enabled = true;
            }
        }
예제 #2
0
 public void FindNextTarget()
 {
     State.CurrentTarget++;
     if (State.CurrentTarget >= State.Targets.Count)
     {
         if (State.UseCharacterRoom)
         {
             State.CurrentTarget = -1;
         }
         else
         {
             State.CurrentTarget = 0;
         }
     }
     //if we use the character room (-1) then cycle that
     //otherwise go for the other targets
     if (State.CurrentTarget > 0)
     {
         ObexTransmitterTarget target = State.Targets [State.CurrentTarget];
     }
     else
     {
         //send the camera to the character room
         TargetCamera.transform.position = CharacterRoomCameraTarget.position;
         TargetCamera.transform.rotation = CharacterRoomCameraTarget.rotation;
         //spawn the character
         if (mSpeakingCharacter == null || mSpeakingCharacter.IsDestroyed)
         {
             if (mCharacterSpawnPoint == null)
             {
                 WorldChunk      c = worlditem.Group.GetParentChunk();
                 ActionNodeState actionNodeState = null;
                 string          nodeName        = worlditem.FileName + "TransmitterNode";
                 if (!c.GetOrCreateNode(worlditem.Group, worlditem.tr, worlditem.FileName + "TransmitterNode", out actionNodeState))
                 {
                     Debug.LogError("Couldn't create spawn node " + nodeName + " in transmitter to create character");
                     return;
                 }
                 actionNodeState.actionNode.transform.position = CharacterRoomCharacterTarget.position;
                 actionNodeState.CustomConversation            = State.CharacterConversation;
                 if (!Characters.GetOrSpawnCharacter(actionNodeState.actionNode, State.CharacterName, worlditem.Group, out mSpeakingCharacter))
                 {
                     Debug.LogError("Couldn't spawn character " + State.CharacterName + " in transmitter");
                 }
                 else
                 {
                     mSpeakingCharacter.worlditem.ActiveState       = WIActiveState.Visible;
                     mSpeakingCharacter.worlditem.ActiveStateLocked = true;
                     Debug.Log("Setting character's conversation name to " + State.CharacterConversation);
                     //we don't need motile for this character
                     Motile m = null;
                     if (mSpeakingCharacter.worlditem.Is <Motile> (out m))
                     {
                         m.Finish();
                     }
                     mSpeakingCharacter.Body.OnSpawn(mSpeakingCharacter);
                 }
             }
         }
         //initiate conversation with the character if it exists
         //TODO make character look in direction of intermediary
         if (mSpeakingCharacter != null)
         {
             Talkative t = mSpeakingCharacter.worlditem.Get <Talkative> ();
             t.State.ConversationName = State.CharacterConversation;
             t.State.DefaultToDTS     = false;
             mSpeakingCharacter.Body.SetVisible(true);
             mSpeakingCharacter.Body.IgnoreCollisions(true);
             mSpeakingCharacter.Body.LockVisible = true;
             t.SpeakThroughIntermediary(this);
         }
     }
 }