override public float Run()
        {
            interactionSystem = interactionCharacter.GetComponent <SimpleInteractionSystem>();

            if (interactionSystem != null)
            {
                if (interactionSystem.objectBeingHeld)
                {
                    if (interactionSystem.handsUsed == SimpleInteractionSystem.HandsUsed.LeftHand)
                    {
                        interactionCharacter.GetComponent <Animator>().SetTrigger("PutAwayLeft");
                        interactionSystem.ClearData();
                    }
                    if (interactionSystem.handsUsed == SimpleInteractionSystem.HandsUsed.RightHand)
                    {
                        interactionCharacter.GetComponent <Animator>().SetTrigger("PutAwayRight");
                        interactionSystem.ClearData();
                    }
                }
            }
            else
            {
                Debug.Log("There is no interaction system attached to this character.");
            }
            return(0f);
        }
        public static void Play(Char speaker, string speakerName, int lineNumber, string language)
        {
            if (speaker == null)
            {
                return;
            }

                        #if RogoLipSyncIsPresent
            if (lineNumber > -1 && speakerName != "" && KickStarter.speechManager.searchAudioFiles)
            {
                RogoDigital.Lipsync.LipSyncData lipSyncData = null;

                if (KickStarter.speechManager.autoNameSpeechFiles)
                {
                    string filename = "Lipsync/";
                    if (KickStarter.speechManager.placeAudioInSubfolders)
                    {
                        filename += speakerName + "/";
                    }
                    if (language != "" && KickStarter.speechManager.translateAudio)
                    {
                        // Not in original language
                        filename += language + "/";
                    }
                    filename += speakerName + lineNumber;

                    lipSyncData = Resources.Load(filename) as RogoDigital.Lipsync.LipSyncData;

                    if (lipSyncData == null)
                    {
                        ACDebug.LogWarning("No lipsync file found.  Looking for 'Resources/" + filename + "'");
                    }
                }
                else
                {
                    Object _object = KickStarter.speechManager.GetLineCustomLipsyncFile(lineNumber, Options.GetLanguage());
                    if (_object is RogoDigital.Lipsync.LipSyncData)
                    {
                        lipSyncData = (RogoDigital.Lipsync.LipSyncData)_object;
                    }
                }

                if (lipSyncData != null)
                {
                    if (speaker.GetComponent <RogoDigital.Lipsync.LipSync>() != null)
                    {
                        speaker.GetComponent <RogoDigital.Lipsync.LipSync>().Play(lipSyncData);
                    }
                    else
                    {
                        ACDebug.LogWarning("No LipSync component found on " + speaker.gameObject.name + " gameobject.");
                    }
                }
            }
                        #else
            ACDebug.LogError("The 'RogoLipSyncIsPresent' preprocessor define must be declared in the Player Settings.");
                        #endif
        }
        protected void ApplyRenderData(Char character, NPCData npcData)
        {
            character.lockDirection = npcData.lockDirection;
            character.lockScale     = npcData.lockScale;
            if (character.spriteChild && character.spriteChild.GetComponent <FollowSortingMap>())
            {
                character.spriteChild.GetComponent <FollowSortingMap>().lockSorting = npcData.lockSorting;
            }
            else if (character.GetComponent <FollowSortingMap>())
            {
                character.GetComponent <FollowSortingMap>().lockSorting = npcData.lockSorting;
            }
            else
            {
                character.ReleaseSorting();
            }

            if (npcData.lockDirection)
            {
                character.spriteDirection = npcData.spriteDirection;
            }
            if (npcData.lockScale)
            {
                character.spriteScale = npcData.spriteScale;
            }
            if (npcData.lockSorting)
            {
                if (character.spriteChild && character.spriteChild.GetComponent <Renderer>())
                {
                    character.spriteChild.GetComponent <Renderer>().sortingOrder     = npcData.sortingOrder;
                    character.spriteChild.GetComponent <Renderer>().sortingLayerName = npcData.sortingLayer;
                }
                else if (character.GetComponent <Renderer>())
                {
                    character.GetComponent <Renderer>().sortingOrder     = npcData.sortingOrder;
                    character.GetComponent <Renderer>().sortingLayerName = npcData.sortingLayer;
                }
            }

            if (character.GetComponentsInChildren <FollowSortingMap>() != null)
            {
                FollowSortingMap[] followSortingMaps = character.GetComponentsInChildren <FollowSortingMap>();
                SortingMap         customSortingMap  = Serializer.returnComponent <SortingMap> (npcData.customSortingMapID);

                foreach (FollowSortingMap followSortingMap in followSortingMaps)
                {
                    followSortingMap.followSortingMap = npcData.followSortingMap;
                    if (!npcData.followSortingMap && customSortingMap != null)
                    {
                        followSortingMap.SetSortingMap(customSortingMap);
                    }
                    else
                    {
                        followSortingMap.SetSortingMap(KickStarter.sceneSettings.sortingMap);
                    }
                }
            }
        }
示例#4
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        player    = AC.KickStarter.player;
        ik        = player.GetComponent <FullBodyBipedIK>();
        intSystem = player.GetComponent <InteractionSystem>();


        rightHandTarget = player.GetComponent <InteractionSystem>().interactionObject.rHandTarget;
        leftHandTarget  = player.GetComponent <InteractionSystem>().interactionObject.lHandTarget;
    }
        public static void Stop(Char speaker)
        {
            if (speaker == null)
            {
                return;
            }

                        #if RogoLipSyncIsPresent
            if (speaker.GetComponent <RogoDigital.Lipsync.LipSync>() != null)
            {
                speaker.GetComponent <RogoDigital.Lipsync.LipSync>().Stop(true);
            }
                        #endif
        }
        public static AudioSource Play(Char speaker, int lineID, string language)
        {
            if (speaker == null)
            {
                return(null);
            }

                        #if RogoLipSyncIsPresent
            if (lineID > -1 && speaker != null && KickStarter.speechManager.searchAudioFiles)
            {
                LipSyncData lipSyncData = (LipSyncData)KickStarter.runtimeLanguages.GetSpeechLipsyncFile <LipSyncData> (lineID, speaker);

                if (lipSyncData != null)
                {
                    LipSync lipSync = speaker.GetComponent <LipSync>();
                    if (lipSync != null && lipSync.enabled)
                    {
                        lipSync.Play(lipSyncData);
                        return((lipSyncData.clip) ? lipSync.audioSource : null);
                    }
                    else
                    {
                        ACDebug.LogWarning("No LipSync component found on " + speaker.gameObject.name + " gameobject.");
                    }
                }
            }
                        #else
            ACDebug.LogError("The 'RogoLipSyncIsPresent' preprocessor define must be declared in the Player Settings.");
                        #endif

            return(null);
        }
示例#7
0
    public override void OnClick()
    {
        if (action == "yes")
        {
            // quit app
            Application.Quit();
        }
        else if (action == "no")
        {
            transform.parent.gameObject.SetActive(false);

            if (handleHands)
            {
                if (Char.GetComponent <ClipUtils>().isInMonsterMode)
                {
                    Char.GetComponent <ClipUtils>().hand1.SetActive(false);
                    Char.GetComponent <ClipUtils>().hand2.SetActive(false);
                }
            }
            else
            {
                hand1.SetActive(false);
                hand2.SetActive(false);
            }

            Time.timeScale = 1.0f;
        }
        outlineMat.SetFloat("_OutlineIntensity", 1f);
        //play click sound
        audioSources[0].Play();
    }
示例#8
0
        override public float Run()
        {
            if (!isRunning)
            {
                isRunning = true;

                if (_char)
                {
                    CharSpine charSpine = _char.GetComponent <CharSpine> ();
                    if (charSpine)
                    {
                        charSpine.skeletonAnimation.skeleton.SetColor(newColor);
                    }
                }

                if (willWait && !isInstant)
                {
                    return(fadeSpeed);
                }

                return(0f);
            }

            else
            {
                isRunning = false;
                return(0f);
            }
        }
示例#9
0
    void OnGUI()
    {
        int x = 400;
        int i = 1;

        foreach (GameObject Char in chars)
        {
            GUILayout.BeginArea(new Rect((Char.transform.position.x * 85) + 850, Screen.height - 140, 70, 100));
            if (GUILayout.Button("Next"))
            {
                if (Char.GetComponent <charSelection>().male)
                {
                    Char.GetComponent <charSelection>().male = false;
                }
                else
                {
                    Char.GetComponent <charSelection>().male = true;
                }
            }
            i += 1;
            x += 120;
            GUILayout.EndArea();
        }


        if (GUILayout.Button("GO!"))
        {
            Application.LoadLevel(2);
        }
    }
    private void Start()
    {
        if (isMainCharacter)
        {
            player = KickStarter.player;
        }
        else
        {
            player = GetComponent <NPC>();
        }

        interactionSystem = player.GetComponent <InteractionSystem>();
        controller        = player.GetComponent <ObjectInteractControl>();
        audioSource       = player.GetComponent <AudioSource>();
        objectBeingHeld   = false;
    }
示例#11
0
    //Gets the possible targets
    public void GetTargets()
    {
        //Empty Targets
        PossibleTargets.Clear();

        //Fill Possible Targets
        foreach (GameObject Char in BSM.PlayerChars)
        {
            if ((BSM.ThisTurn.Action.MustBeDown == true && Char.GetComponent <BaseCharStateMachine>().Status_Down == true) || BSM.ThisTurn.Action.MustBeDown == false)
            {
                PossibleTargets.Add(Char);
            }
        }

        //If Free-For-All match, Fill in EnemyChars other than this one
        if (BSM.Refferee.MatchType == ReffSM.Type.T_THREAT || BSM.Refferee.MatchType == ReffSM.Type.F_FOURWAY)
        {
            foreach (GameObject Char in BSM.EnemyChars)
            {
                if (Char != Wrestler)
                {
                    if ((BSM.ThisTurn.Action.MustBeDown == true && Char.GetComponent <BaseCharStateMachine>().Status_Down == true) || BSM.ThisTurn.Action.MustBeDown == false)
                    {
                        PossibleTargets.Add(Char);
                    }
                }
            }
        }
    }
        override public void AssignConstantIDs(bool saveScriptsToo)
        {
            if (saveScriptsToo)
            {
                if (!isPlayer && _char != null && _char.GetComponent <NPC>())
                {
                    AddSaveScript <RememberNPC> (_char);
                }

                AddSaveScript <RememberTransform> (objectToHold);
                if (objectToHold != null && objectToHold.GetComponent <RememberTransform>())
                {
                    objectToHold.GetComponent <RememberTransform>().saveParent = true;
                    if (objectToHold.transform.parent)
                    {
                        AddSaveScript <ConstantID> (objectToHold.transform.parent.gameObject);
                    }
                }
            }

            if (!isPlayer)
            {
                AssignConstantID <Char> (_char, _charID, 0);
            }
            AssignConstantID(objectToHold, objectToHoldID, objectToHoldParameterID);
        }
        override public float Run()
        {
            interactionSystem = interactionCharacter.GetComponent <InteractionSystem>();

            if (interactionSystem != null)
            {
                if (handsUsed == HandsUsed.Both)
                {
                    interactionSystem.isBothHands = true;
                    interactionSystem.isRightHand = false;
                    interactionSystem.isLeftHand  = false;
                    interactionSystem.noHandIK    = false;
                }
                if (handsUsed == HandsUsed.Right)
                {
                    interactionSystem.isRightHand = true;
                    interactionSystem.isLeftHand  = false;
                    interactionSystem.isBothHands = false;
                    interactionSystem.noHandIK    = false;
                }
                if (handsUsed == HandsUsed.Left)
                {
                    interactionSystem.isLeftHand  = true;
                    interactionSystem.isBothHands = false;
                    interactionSystem.isRightHand = false;
                    interactionSystem.noHandIK    = false;
                }
                if (handsUsed == HandsUsed.None)
                {
                    interactionSystem.noHandIK    = true;
                    interactionSystem.isLeftHand  = false;
                    interactionSystem.isBothHands = false;
                    interactionSystem.isRightHand = false;
                }

                if (interactionSystem.objectBeingHeld)
                {
                    InteractionAnimation(trigger.name);
                }
            }
            else
            {
                Debug.Log("There is no interaction system attached to this character.");
            }
            return(0f);
        }
        override public float Run()
        {
            interactionSystem = interactionCharacter.GetComponent <InteractionSystem>();

            if (interactionSystem != null)
            {
                //Clear the existing values
                interactionSystem.ClearData();

                //Send the new values
                PopulateValues(interactionSystem);
            }
            else
            {
                Debug.Log("There is no interaction system attached to this character.");
            }
            return(0f);
        }
示例#15
0
 private void AddHealths()
 {
     GameOver.SetActive(false);
     CharSprite.SetActive(true);
     ProrsImage.SetActive(true);
     HealthScaleChar.fillAmount             = 0.5f;
     Char.GetComponent <MoveChar>().enabled = true;
     Controller.NextMovePlayer = true;
     Healths.isGameOver        = false;
 }
 //Add the state machines to each list
 void AddSMsToList()
 {
     foreach (GameObject Char in PlayerChars)
     {
         AllChars.Add(Char.GetComponent <PlayerStateMachine>());
     }
     foreach (GameObject Char in EnemyChars)
     {
         AllChars.Add(Char.GetComponent <EnemyStateMachine>());
     }
 }
示例#17
0
        override public void AssignConstantIDs(bool saveScriptsToo)
        {
            if (!isPlayer)
            {
                if (saveScriptsToo && charToMove != null && charToMove.GetComponent <NPC>())
                {
                    AddSaveScript <RememberNPC> (charToMove);
                }

                AssignConstantID <Char> (charToMove, charToMoveID, charToMoveParameterID);
            }
        }
示例#18
0
    private IEnumerator EndMessage()
    {
        StopCoroutine("StartMessage");
        isSkippable = false;

        if (speakerChar)
        {
            // Turn off animations on the character's "mouth" layer
            if (speakerChar.GetComponent <Animation>())
            {
                foreach (AnimationState state in speakerChar.GetComponent <Animation>().animation)
                {
                    if (state.layer == (int)AnimLayer.Mouth)
                    {
                        state.normalizedTime = 1f;
                        state.weight         = 0f;
                    }
                }
            }

            if (speakerChar.GetComponent <AudioSource>())
            {
                speakerChar.GetComponent <AudioSource>().Stop();
            }
        }

        // Wait a short moment for fade-out
        yield return(new WaitForSeconds(0.3f));

        isMessageAlive = false;
    }
 private void Start()
 {
     if (isMainCharacter)
     {
         character = KickStarter.player;
     }
     else
     {
         character = GetComponent <NPC>();
     }
     audioSource     = character.GetComponent <AudioSource>();
     isHoldingObject = false;
 }
        protected void Visible(string text)
        {
            String[] components = text.Split(',');
            bool     state      = SetBoolean(components[1].Trim().ToLower());

            foreach (GameObject obj in objects)
            {
                if (obj.name.ToLower() == components[0].Trim().ToLower())
                {
                    if (obj.GetComponent <Renderer>())
                    {
                        obj.GetComponent <Renderer>().enabled = state;
                    }
                    foreach (Renderer _renderer in obj.GetComponentsInChildren <Renderer>())
                    {
                        _renderer.enabled = state;
                    }
                    return;
                }
            }

            Char actor = GetActorFrom(components[0]);

            if (actor != null)
            {
                if (actor.name.ToLower() == components[0].Trim().ToLower())
                {
                    if (actor.GetComponent <Renderer>())
                    {
                        actor.GetComponent <Renderer>().enabled = state;
                    }
                    foreach (Renderer _renderer in actor.GetComponentsInChildren <Renderer>())
                    {
                        _renderer.enabled = state;
                    }
                }
            }
        }
示例#21
0
 public override void Update()
 {
     if (handleHands)
     {
         Char.GetComponent <ClipUtils>().hand1.SetActive(true);
         Char.GetComponent <ClipUtils>().hand2.SetActive(true);
     }
     else
     {
         hand1.SetActive(true);
         hand2.SetActive(true);
     }
     Time.timeScale = 0.0f;
 }
        override public void AssignConstantIDs(bool saveScriptsToo, bool fromAssetFile)
        {
            if (!isPlayer)
            {
                if (saveScriptsToo)
                {
                    if (_char != null && _char.GetComponent <NPC>())
                    {
                        AddSaveScript <RememberNPC> (_char);
                    }
                }

                AssignConstantID <Char> (_char, constantID, parameterID);
            }
        }
示例#23
0
        override public void AssignConstantIDs(bool saveScriptsToo)
        {
            if (!isPlayer)
            {
                if (saveScriptsToo)
                {
                    if (_char != null && _char.GetComponent <NPC>())
                    {
                        AddSaveScript <RememberNPC> (_char);
                    }
                }

                AssignConstantID <Char> (_char, _charID, 0);
            }
        }
示例#24
0
        public override void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
        {
            if (propertiesThatChanged.ContainsKey(MPGame.TEAM1_SCORE) || propertiesThatChanged.ContainsKey(MPGame.TEAM2_SCORE))
            {
                ScoreDisplay.text = team1.name + ": " + team1.score.ToString() + "\n" + team2.name + ": " + team2.score.ToString();

                int iii = 0;
                int jjj = 0;
                foreach (GameObject Char in Characters)
                {
                    if (iii % 2 == 0)
                    {
                        jjj = 1;
                    }
                    else
                    {
                        jjj = -1;
                    }
                    Char.transform.position = new Vector3(iii + 9, 0, jjj * 30);
                    object health;
                    if (Char.GetComponent <PhotonView>().Owner.CustomProperties.TryGetValue(PunPlayerProps.PlayerCharacterHPProp, out health))
                    {
                        health = Char.GetComponent <PhotonView>().Owner.GetCharacter().HP;
                    }

                    Hashtable props = new Hashtable
                    {
                        { PunPlayerProps.PlayerCharacterHPProp, health }
                    };
                    Char.GetComponent <PhotonView>().Owner.SetCustomProperties(props);
                    Char.GetComponent <Character>().Health = Char.GetComponent <PhotonView>().Owner.GetCharacter().HP;

                    iii++;
                }
            }

            if (propertiesThatChanged.ContainsKey(MPGame.GAME_ENDING))
            {
                object teamwin;
                if (PhotonNetwork.LocalPlayer.CustomProperties.TryGetValue(PunPlayerProps.PlayerTeamProp, out teamwin))
                {
                    GameOverDisplay.text = "Team " + teamwin.ToString() + " Wins";
                    GameOverDisplay.gameObject.SetActive(true);
                }

                PhotonNetwork.LeaveLobby();
            }
        }
示例#25
0
        override public void AssignValues(List <ActionParameter> parameters)
        {
            if (parameters != null)
            {
                ownParameters = parameters;
            }

            runtimeSpeaker = AssignFile <Char> (parameters, parameterID, constantID, speaker);

            // Special case: Use associated NPC
            if (runtimeSpeaker != null &&
                runtimeSpeaker is Player &&
                KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow &&
                KickStarter.player != null)
            {
                // Make sure not the active Player
                ConstantID speakerID = speaker.GetComponent <ConstantID>();
                ConstantID playerID  = KickStarter.player.GetComponent <ConstantID>();
                if ((speakerID == null && playerID != null) ||
                    (speakerID != null && playerID == null) ||
                    (speakerID != null && playerID != null && speakerID.constantID != playerID.constantID))
                {
                    Player speakerPlayer = runtimeSpeaker as Player;
                    foreach (PlayerPrefab playerPrefab in KickStarter.settingsManager.players)
                    {
                        if (playerPrefab != null && playerPrefab.playerOb == speakerPlayer)
                        {
                            if (speakerPlayer.associatedNPCPrefab != null)
                            {
                                ConstantID npcConstantID = speakerPlayer.associatedNPCPrefab.GetComponent <ConstantID>();
                                if (npcConstantID != null)
                                {
                                    runtimeSpeaker = AssignFile <Char> (parameters, parameterID, npcConstantID.constantID, runtimeSpeaker);
                                }
                            }
                            break;
                        }
                    }
                }
            }

            messageText = AssignString(parameters, messageParameterID, messageText);

            if (isPlayer)
            {
                runtimeSpeaker = KickStarter.player;
            }
        }
示例#26
0
        public override void AssignConstantIDs(bool saveScriptsToo, bool fromAssetFile)
        {
            if (saveScriptsToo)
            {
                if (!isPlayer && charToMove != null && charToMove.GetComponent <NPC>())
                {
                    AddSaveScript <RememberNPC> (charToMove);
                }
            }

            if (!isPlayer)
            {
                AssignConstantID <Char> (charToMove, charToMoveID, charToMoveParameterID);
            }
            AssignConstantID <Marker> (marker, markerID, markerParameterID);
        }
示例#27
0
        override public void AssignConstantIDs(bool saveScriptsToo)
        {
            if (saveScriptsToo)
            {
                if (!followPlayer && charToFollow != null && charToFollow.GetComponent <NPC>())
                {
                    AddSaveScript <RememberNPC> (charToFollow);
                }
                AddSaveScript <RememberNPC> (npcToMove);
            }

            if (!followPlayer)
            {
                AssignConstantID <Char> (charToFollow, charToFollowID, charToFollowParameterID);
            }
            AssignConstantID <NPC> (npcToMove, npcToMoveID, npcToMoveParameterID);
        }
示例#28
0
        override public void AssignConstantIDs(bool saveScriptsToo, bool fromAssetFile)
        {
            if (saveScriptsToo)
            {
                AddSaveScript <ConstantID> (movePath);
                if (!isPlayer && charToMove != null && charToMove.GetComponent <NPC>())
                {
                    AddSaveScript <RememberNPC> (charToMove);
                }
            }

            if (!isPlayer)
            {
                AssignConstantID <Char> (charToMove, charToMoveID, charToMoveParameterID);
            }
            AssignConstantID <Paths> (movePath, movePathID, movePathParameterID);
        }
示例#29
0
        override public void AssignConstantIDs(bool saveScriptsToo, bool fromAssetFile)
        {
            if (saveScriptsToo)
            {
                if (!isPlayer && charToMove != null && charToMove.GetComponent <NPC>())
                {
                    AddSaveScript <RememberNPC> (charToMove);
                }
                if (faceType == CharFaceType.Head && faceObject != null)
                {
                    AddSaveScript <ConstantID> (faceObject);
                }
            }

            if (!isPlayer)
            {
                AssignConstantID <Char> (charToMove, charToMoveID, charToMoveParameterID);
            }
            AssignConstantID(faceObject, faceObjectID, faceObjectParameterID);
        }
    public void InitializeCatwalkDressUp()
    {
        DeleteAllChars();

        foreach (var Char in EventManagment.Instance.SelectedRoommates)
        {
            GameObject Background = Instantiate(Prefab.gameObject, Vector3.zero, Quaternion.identity) as GameObject;

            Background.transform.parent     = Container.transform;
            Background.transform.localScale = Vector3.one;

            var Component = Background.GetComponent <CatwalkCharacter> ();

            var _flatMate = Char.GetComponent <Flatmate> ();
            Component.Name           = _flatMate.data.Name.Trim('"');
            Component.thisController = this;

            GameObject CharRep = Instantiate(Char, Vector3.zero, Quaternion.identity) as GameObject;
            CharRep.gameObject.SetActive(true);
            CharRep.transform.parent           = Background.transform;
            CharRep.transform.localPosition    = new Vector2(0, -160);
            CharRep.transform.localScale       = new Vector2(40, 40);
            CharRep.transform.rotation         = Quaternion.identity;
            CharRep.transform.localEulerAngles = new Vector3(0, 0, 0);

            int Layer = LayerMask.NameToLayer("UI3D");
            CharRep.SetLayerRecursively(Layer);

            CharRep.GetComponent <GenerateMoney> ().enabled = false;
            if (CharRep.GetComponent <RoomMateMovement> ())
            {
                Destroy(CharRep.GetComponent <RoomMateMovement> ());
            }

            //              GameObject.Destroy (CharRep.transform.GetChild (12).gameObject);
            GameObject.Destroy(CharRep.transform.FindChild("low money").gameObject);
//            ThisCamera.enabled = true;
        }
        ThisCamera.enabled = true;
    }