コード例 #1
0
ファイル: CharEditor.cs プロジェクト: IJkeB/Ekster1
    protected void SharedGUITwo(AC.Char _target)
    {
        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Rigidbody settings:", EditorStyles.boldLabel);
        _target.ignoreGravity           = EditorGUILayout.Toggle("Ignore gravity?", _target.ignoreGravity);
        _target.freezeRigidbodyWhenIdle = EditorGUILayout.Toggle("Freeze when Idle?", _target.freezeRigidbodyWhenIdle);
        EditorGUILayout.EndVertical();


        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Audio clips:", EditorStyles.boldLabel);

        _target.walkSound  = (AudioClip)EditorGUILayout.ObjectField("Walk sound:", _target.walkSound, typeof(AudioClip), false);
        _target.runSound   = (AudioClip)EditorGUILayout.ObjectField("Run sound:", _target.runSound, typeof(AudioClip), false);
        _target.soundChild = (Sound)EditorGUILayout.ObjectField("Sound child:", _target.soundChild, typeof(Sound), true);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Dialogue settings:", EditorStyles.boldLabel);

        EditorGUILayout.LabelField("Portrait graphic:");
        _target.portraitIcon.ShowGUI(false);
        _target.speechColor = EditorGUILayout.ColorField("Speech text colour:", _target.speechColor);
        _target.speechLabel = EditorGUILayout.TextField("Speaker label:", _target.speechLabel);
        EditorGUILayout.EndVertical();
    }
コード例 #2
0
ファイル: AnimEngine.cs プロジェクト: IJkeB/Ekster1
 public virtual void Declare(AC.Char _character)
 {
     character     = _character;
     turningStyle  = TurningStyle.Script;
     rootMotion    = false;
     isSpriteBased = false;
 }
コード例 #3
0
		override public void ShowGUI (List<ActionParameter> parameters)
		{
			// Action-specific Inspector GUI code here
			isPlayer = EditorGUILayout.Toggle ("Is Player?", isPlayer);
			if (isPlayer)
			{
				if (Application.isPlaying)
				{
					_char = KickStarter.player;
				}
				else
				{
					_char = AdvGame.GetReferences ().settingsManager.GetDefaultPlayer ();
				}
			}
			else
			{
				parameterID = Action.ChooseParameterGUI ("Character:", parameters, parameterID, ParameterType.GameObject);
				if (parameterID >= 0)
				{
					constantID = 0;
					_char = null;
				}
				else
				{
					_char = (Char) EditorGUILayout.ObjectField ("Character:", _char, typeof (Char), true);
					
					constantID = FieldToID <Char> (_char, constantID);
					_char = IDToField <Char> (_char, constantID, false);
				}
			}
			
			newPortraitGraphic = (Texture2D) EditorGUILayout.ObjectField ("New Portrait graphic:", newPortraitGraphic, typeof (Texture2D), true);
			AfterRunningOption ();
		}
コード例 #4
0
 public override void Declare(AC.Char _character)
 {
     character     = _character;
     turningStyle  = TurningStyle.Linear;
     rootMotion    = false;
     isSpriteBased = true;
 }
コード例 #5
0
	public virtual void Declare (AC.Char _character)
	{
		character = _character;
		turningIsLinear = false;
		rootMotion = false;
		isSpriteBased = false;
	}
コード例 #6
0
        public override void AssignValues(List<ActionParameter> parameters)
        {
            charToMove = AssignFile <Char> (parameters, charToMoveParameterID, charToMoveID, charToMove);

            if (isPlayer)
            {
                charToMove = KickStarter.player;
            }
        }
コード例 #7
0
        public override void AssignValues(List<ActionParameter> parameters)
        {
            _char = AssignFile <Char> (_charID, _char);

            if (isPlayer)
            {
                _char = KickStarter.player;
            }
        }
コード例 #8
0
ファイル: NPC.cs プロジェクト: IJkeB/Ekster_Final
        public void FollowReset()
        {
            FollowStop ();

            followTarget = null;
            followTargetIsPlayer = false;
            followFrequency = 0f;
            followDistance = 0f;
        }
コード例 #9
0
		override public void AssignValues (List<ActionParameter> parameters)
		{
			_char = AssignFile <Char> (parameters, parameterID, constantID, _char);

			if (isPlayer)
			{
				_char = KickStarter.player;
			}
		}
コード例 #10
0
		override public void AssignValues (List<ActionParameter> parameters)
		{
			_char = AssignFile <Char> (_charID, _char);
			objectToHold = AssignFile (parameters, objectToHoldParameterID, objectToHoldID, objectToHold);

			if (isPlayer)
			{
				_char = KickStarter.player;
			}
		}
コード例 #11
0
ファイル: ActionSpeech.cs プロジェクト: IJkeB/Ekster_Final
        public override void AssignValues(List<ActionParameter> parameters)
        {
            speaker = AssignFile <Char> (parameters, parameterID, constantID, speaker);
            messageText = AssignString (parameters, messageParameterID, messageText);

            if (isPlayer)
            {
                speaker = KickStarter.player;
            }
        }
コード例 #12
0
		public override void AssignValues (List<ActionParameter> parameters)
		{
			charToMove = AssignFile <Char> (parameters, charToMoveParameterID, charToMoveID, charToMove);
			faceObject = AssignFile (parameters, faceObjectParameterID, faceObjectID, faceObject);

			if (isPlayer)
			{
				charToMove = KickStarter.player;
			}
			else if (facePlayer && KickStarter.player)
			{
				faceObject = KickStarter.player.gameObject;
			}
		}
コード例 #13
0
		override public void AssignValues (List<ActionParameter> parameters)
		{
			animChar = AssignFile <Char> (parameters, parameterID, constantID, animChar);

			if (isPlayer)
			{
				animChar = KickStarter.player;
			}

			if (animChar && animChar.animEngine == null)
			{
				animChar.ResetAnimationEngine ();
			}
		}
コード例 #14
0
        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
        }
コード例 #15
0
		override public void ShowGUI (List<ActionParameter> parameters)
		{
			isPlayer = EditorGUILayout.Toggle ("Is Player?", isPlayer);
			if (!isPlayer)
			{
				_char = (Char) EditorGUILayout.ObjectField ("Character:", _char, typeof (Char), true);
				
				_charID = FieldToID <Char> (_char, _charID);
				_char = IDToField <Char> (_char, _charID, true);
			}
			
			newName = EditorGUILayout.TextField ("New name:", newName);
			
			AfterRunningOption ();
		}
コード例 #16
0
ファイル: ActionCharHold.cs プロジェクト: mcbodge/eidolon
        public override void AssignValues(List<ActionParameter> parameters)
        {
            _char = AssignFile <Char> (_charID, _char);
            objectToHold = AssignFile (parameters, objectToHoldParameterID, objectToHoldID, objectToHold);

            if (!objectToHold.activeInHierarchy)
            {
                loadedObject = (GameObject) Instantiate (objectToHold);
            }

            if (isPlayer)
            {
                _char = KickStarter.player;
            }
        }
コード例 #17
0
    public override Vector3[] GetPointsArray(AC.Char _char, Vector3 _originPos, Vector3 _targetPos)
    {
        PolygonCollider2D poly = KickStarter.sceneSettings.navMesh.transform.GetComponent <PolygonCollider2D>();
        bool changesMade       = KickStarter.sceneSettings.navMesh.AddCharHoles(_char);

        List <Vector3> pointsList3D = new List <Vector3> ();

        if (IsLineClear(_originPos, _targetPos))
        {
            pointsList3D.Add(_targetPos);
            //ResetHoles (KickStarter.sceneSettings.navMesh, changesMade);
            return(pointsList3D.ToArray());
        }

        Vector2[] pointsList = CreateVertexArray(poly);

        Vector2 originPos = GetNearestToMesh(_originPos, poly);
        Vector2 targetPos = GetNearestToMesh(_targetPos, poly);

        pointsList = AddEndsToList(pointsList, originPos, targetPos);

        float[,] weight = pointsToWeight(pointsList);

        int[] precede = buildSpanningTree(0, 1, weight);
        if (precede == null)
        {
            Debug.LogWarning("Pathfinding error");
            pointsList3D.Add(_targetPos);
            return(pointsList3D.ToArray());
        }
        int[] _path = getShortestPath(0, 1, precede);

        foreach (int i in _path)
        {
            Vector3 vertex = new Vector3(pointsList[i].x, pointsList[i].y, _originPos.z);
            pointsList3D.Insert(0, vertex);
        }

        if (pointsList3D[0] == _originPos || (pointsList3D[0].x == originPos.x && pointsList3D[0].y == originPos.y))
        {
            pointsList3D.RemoveAt(0);                   // Remove origin point from start
        }

        ResetHoles(KickStarter.sceneSettings.navMesh, changesMade);
        return(pointsList3D.ToArray());
    }
コード例 #18
0
        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)
            {
                string filename = "Lipsync/";
                if (KickStarter.speechManager.placeAudioInSubfolders)
                {
                    filename += speakerName + "/";
                }
                if (language != "" && KickStarter.speechManager.translateAudio)
                {
                    // Not in original language
                    filename += language + "/";
                }
                filename += speakerName + lineNumber;

                RogoDigital.Lipsync.LipSyncData lipSyncData = Resources.Load (filename) as RogoDigital.Lipsync.LipSyncData;
                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.LogWarning ("No lipsync file found.  Looking for 'Resources/" + filename + "'");
                }
            }
            #else
            ACDebug.LogError ("The 'RogoLipSyncIsPresent' preprocessor define must be declared in the Player Settings.");
            #endif
        }
コード例 #19
0
ファイル: NPC.cs プロジェクト: farreltr/OneLastSunset
        /**
         * <summary>Assigns a new target (NPC or Player) to start following.</summary>
         * <param name = "_followTarget">The target to follow</param>
         * <param name = "_followTargetIsPlayer">If True, the NPC will follow the current Player, and _followTarget will be ignored</param>
         * <param name = "_followFrequency">The frequency with which to follow the target</param>
         * <param name = "_followDistance">The minimum distance to keep from the target</param>
         * <param name = "_followDistanceMax">The maximum distance to keep from the target</param>
         */
        public void FollowAssign(Char _followTarget, bool _followTargetIsPlayer, float _followFrequency, float _followDistance, float _followDistanceMax)
        {
            if (_followTargetIsPlayer)
            {
                _followTarget = KickStarter.player;
            }

            if (_followTarget == null || _followFrequency == 0f || _followFrequency < 0f || _followDistance <= 0f || _followDistanceMax <= 0f)
            {
                StopFollowing ();
                return;
            }

            followTarget = _followTarget;
            followTargetIsPlayer = _followTargetIsPlayer;
            followFrequency = _followFrequency;
            followDistance = _followDistance;
            followDistanceMax = _followDistanceMax;

            FollowUpdate ();
        }
コード例 #20
0
ファイル: CharEditor.cs プロジェクト: IJkeB/Ekster1
    protected void SharedGUIOne(AC.Char _target)
    {
        if (_target.animEngine == null || !_target.animEngine.ToString().Contains(_target.animationEngine.ToString()))
        {
            _target.ResetAnimationEngine();
        }

        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Animation settings:", EditorStyles.boldLabel);
        _target.animationEngine = (AnimationEngine)EditorGUILayout.EnumPopup("Animation engine:", _target.animationEngine);
        if (_target.animationEngine == AnimationEngine.Sprites2DToolkit && !tk2DIntegration.IsDefinePresent())
        {
            EditorGUILayout.HelpBox("The 'tk2DIsPresent' preprocessor define must be declared in the\ntk2DIntegration.cs script. Please open it and follow instructions.", MessageType.Warning);
        }
        if (_target.animationEngine == AnimationEngine.Custom)
        {
            _target.customAnimationClass = EditorGUILayout.TextField("Script name:", _target.customAnimationClass);
            _target.motionControl        = (MotionControl)EditorGUILayout.EnumPopup("Motion control:", _target.motionControl);
        }
        EditorGUILayout.EndVertical();

        _target.animEngine.CharSettingsGUI();

        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Movement settings:", EditorStyles.boldLabel);

        if (_target.GetMotionControl() == MotionControl.Automatic)
        {
            _target.walkSpeedScale = EditorGUILayout.FloatField("Walk speed scale:", _target.walkSpeedScale);
            _target.runSpeedScale  = EditorGUILayout.FloatField("Run speed scale:", _target.runSpeedScale);
            _target.acceleration   = EditorGUILayout.FloatField("Acceleration:", _target.acceleration);
            _target.deceleration   = EditorGUILayout.FloatField("Deceleration:", _target.deceleration);
        }
        if (_target.GetMotionControl() != MotionControl.Manual)
        {
            _target.turnSpeed = EditorGUILayout.FloatField("Turn speed:", _target.turnSpeed);
        }
        _target.turnBeforeWalking = EditorGUILayout.Toggle("Turn before walking?", _target.turnBeforeWalking);
        EditorGUILayout.EndVertical();
    }
コード例 #21
0
		override public void ShowGUI (List<ActionParameter> parameters)
		{
			isPlayer = EditorGUILayout.Toggle ("Affect Player?", isPlayer);
			if (!isPlayer)
			{
				charToMoveParameterID = Action.ChooseParameterGUI ("Character to turn:", parameters, charToMoveParameterID, ParameterType.GameObject);
				if (charToMoveParameterID >= 0)
				{
					charToMoveID = 0;
					charToMove = null;
				}
				else
				{
					charToMove = (Char) EditorGUILayout.ObjectField ("Character to turn:", charToMove, typeof(Char), true);
					
					charToMoveID = FieldToID <Char> (charToMove, charToMoveID);
					charToMove = IDToField <Char> (charToMove, charToMoveID, false);
				}

				facePlayer = EditorGUILayout.Toggle ("Face player?", facePlayer);
			}
			else
			{
				facePlayer = false;
				
				SettingsManager settingsManager = AdvGame.GetReferences ().settingsManager;
				if (faceType == CharFaceType.Body && settingsManager && settingsManager.IsInFirstPerson ())
				{
					lookUpDown = EditorGUILayout.Toggle ("FPS head tilt?", lookUpDown);
				}
			}

			faceType = (CharFaceType) EditorGUILayout.EnumPopup ("Face with:", faceType);
			if (faceType == CharFaceType.Head)
			{
				stopLooking = EditorGUILayout.Toggle ("Stop looking?", stopLooking);
			}

			if (facePlayer || (faceType == CharFaceType.Head && stopLooking))
			{ }
			else
			{
				faceObjectParameterID = Action.ChooseParameterGUI ("Object to face:", parameters, faceObjectParameterID, ParameterType.GameObject);
				if (faceObjectParameterID >= 0)
				{
					faceObjectID = 0;
					faceObject = null;
				}
				else
				{
					faceObject = (GameObject) EditorGUILayout.ObjectField ("Object to face:", faceObject, typeof(GameObject), true);
					
					faceObjectID = FieldToID (faceObject, faceObjectID);
					faceObject = IDToField (faceObject, faceObjectID, false);
				}
			}

			if (faceType == CharFaceType.Body)
			{
				copyRotation = EditorGUILayout.Toggle ("Use object's rotation?", copyRotation);
			}

			isInstant = EditorGUILayout.Toggle ("Is instant?", isInstant);
			if (!isInstant)
			{
				willWait = EditorGUILayout.Toggle ("Wait until finish?", willWait);
			}

			AfterRunningOption ();
		}
コード例 #22
0
ファイル: NavigationEngine.cs プロジェクト: IJkeB/Ekster1
 public virtual Vector3[] GetPointsArray(AC.Char _char, Vector3 startPosition, Vector3 targetPosition)
 {
     return(GetPointsArray(startPosition, targetPosition));
 }
コード例 #23
0
ファイル: Dialog.cs プロジェクト: Davetheallthing/Space-Walk
 /**
  * <summary>Checks if a given character is speaking.</summary>
  * <param name = "_char".The character to check</param>
  * <returns>True if the character is speaking</returns>
  */
 public bool CharacterIsSpeaking(Char _char)
 {
     foreach (Speech speech in speechList)
     {
         if (speech.GetSpeakingCharacter () == _char)
         {
             return true;
         }
     }
     return false;
 }
コード例 #24
0
		override public void ShowGUI (List<ActionParameter> parameters)
		{
			if (lineID > -1)
			{
				EditorGUILayout.LabelField ("Speech Manager ID:", lineID.ToString ());
			}
			
			isPlayer = EditorGUILayout.Toggle ("Player line?",isPlayer);
			if (isPlayer)
			{
				if (Application.isPlaying)
				{
					speaker = KickStarter.player;
				}
				else
				{
					speaker = AdvGame.GetReferences ().settingsManager.GetDefaultPlayer ();
				}
			}
			else
			{
				parameterID = Action.ChooseParameterGUI ("Speaker:", parameters, parameterID, ParameterType.GameObject);
				if (parameterID >= 0)
				{
					constantID = 0;
					speaker = null;
				}
				else
				{
					speaker = (Char) EditorGUILayout.ObjectField ("Speaker:", speaker, typeof(Char), true);
					
					constantID = FieldToID <Char> (speaker, constantID);
					speaker = IDToField <Char> (speaker, constantID, false);
				}
			}

			EditorGUILayout.LabelField ("Line text:", GUILayout.Width (145f));
			EditorStyles.textField.wordWrap = true;
			messageText = EditorGUILayout.TextArea (messageText);

			if (speaker)
			{
				if (speaker.animEngine == null)
				{
					speaker.ResetAnimationEngine ();
				}
				if (speaker.animEngine)
				{
					speaker.animEngine.ActionSpeechGUI (this);
				}
			}
			else
			{
				EditorGUILayout.HelpBox ("If no Character is set, this line will be considered to be a Narration.", MessageType.Info);
			}
			
			isBackground = EditorGUILayout.Toggle ("Play in background?", isBackground);
			if (!isBackground)
			{
				waitTimeOffset = EditorGUILayout.Slider ("Wait time offset (s):", waitTimeOffset, -1f, 4f);
			}

			AfterRunningOption ();
		}
        public override bool AddCharHoles(PolygonCollider2D navPoly, Char charToExclude)
        {
            if (navPoly == null) return false;

            bool changesMade = false;
            Vector2 navPosition = navPoly.transform.position;
            AC.Char[] characters = GameObject.FindObjectsOfType (typeof (AC.Char)) as AC.Char[];

            foreach (AC.Char character in characters)
            {
                CircleCollider2D circleCollider2D = character.GetComponent <CircleCollider2D>();
                if (circleCollider2D != null && character.charState == CharState.Idle
                    && (charToExclude == null || character != charToExclude)
                    && Physics2D.OverlapPointNonAlloc (character.transform.position, NavigationEngine_PolygonCollider.results, 1 << KickStarter.sceneSettings.navMesh.gameObject.layer) != 0)
                {
                    circleCollider2D.isTrigger = true;

                    List<Vector2> newPoints3D = new List<Vector2>();

                    #if UNITY_5
                    Vector2 centrePoint =  character.transform.TransformPoint (circleCollider2D.offset);
                    #else
                    Vector2 centrePoint =  character.transform.TransformPoint (circleCollider2D.center);
                    #endif

                    float radius = circleCollider2D.radius * character.transform.localScale.x;

                    newPoints3D.Add (centrePoint + Vector2.up * radius);
                    newPoints3D.Add (centrePoint + Vector2.right * radius);
                    newPoints3D.Add (centrePoint - Vector2.up * radius);
                    newPoints3D.Add (centrePoint - Vector2.right * radius);

                    navPoly.pathCount ++;

                    List<Vector2> newPoints = new List<Vector2>();
                    for (int i=0; i<newPoints3D.Count; i++)
                    {
                        // Only add a point if it is on the NavMesh
                        if (Physics2D.OverlapPointNonAlloc (newPoints3D[i], NavigationEngine_PolygonCollider.results, 1 << KickStarter.sceneSettings.navMesh.gameObject.layer) != 0)
                        {
                            newPoints.Add (newPoints3D[i] - navPosition);
                        }
                        else
                        {
                            Vector2 altPoint = GetLineIntersect (newPoints3D[i], centrePoint);
                            if (altPoint != Vector2.zero)
                            {
                                newPoints.Add (altPoint - navPosition);
                            }
                        }
                    }

                    if (newPoints.Count > 1)
                    {
                        navPoly.SetPath (navPoly.pathCount-1, newPoints.ToArray ());
                        changesMade = true;
                    }
                }
            }

            return changesMade;
        }
コード例 #26
0
ファイル: ActionSpeechWait.cs プロジェクト: mcbodge/eidolon
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            isPlayer = EditorGUILayout.Toggle ("Player line?",isPlayer);
            if (isPlayer)
            {
                if (Application.isPlaying)
                {
                    speaker = KickStarter.player;
                }
                else
                {
                    speaker = AdvGame.GetReferences ().settingsManager.GetDefaultPlayer ();
                }
            }
            else
            {
                parameterID = Action.ChooseParameterGUI ("Speaker:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    speaker = null;
                }
                else
                {
                    speaker = (Char) EditorGUILayout.ObjectField ("Speaker:", speaker, typeof(Char), true);

                    constantID = FieldToID <Char> (speaker, constantID);
                    speaker = IDToField <Char> (speaker, constantID, false);
                }
            }

            AfterRunningOption ();
        }
コード例 #27
0
ファイル: ActionSpeech.cs プロジェクト: IJkeB/Ekster_Final
 public void SetSpeaker()
 {
     if (!isPlayer && parameterID == -1)
     {
         speaker = IDToField <Char> (speaker, constantID, false);
     }
 }
コード例 #28
0
ファイル: AnimEngine.cs プロジェクト: mcbodge/eidolon
 public virtual void ActionSpeechGUI(ActionSpeech action, Char speaker)
 {
     #if UNITY_EDITOR
     #endif
 }
コード例 #29
0
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            npcToMoveParameterID = Action.ChooseParameterGUI ("NPC to affect:", parameters, npcToMoveParameterID, ParameterType.GameObject);
            if (npcToMoveParameterID >= 0)
            {
                npcToMoveID = 0;
                npcToMove = null;
            }
            else
            {
                npcToMove = (NPC) EditorGUILayout.ObjectField ("NPC to affect:", npcToMove, typeof(NPC), true);

                npcToMoveID = FieldToID <NPC> (npcToMove, npcToMoveID);
                npcToMove = IDToField <NPC> (npcToMove, npcToMoveID, false);
            }

            followType = (FollowType) EditorGUILayout.EnumPopup ("Follow type:", followType);
            if (followType == FollowType.StartFollowing)
            {
                followPlayer = EditorGUILayout.Toggle ("Follow Player?", followPlayer);

                if (!followPlayer)
                {
                    charToFollowParameterID = Action.ChooseParameterGUI ("Character to follow:", parameters, charToFollowParameterID, ParameterType.GameObject);
                    if (charToFollowParameterID >= 0)
                    {
                        charToFollowID = 0;
                        charToFollow = null;
                    }
                    else
                    {
                        charToFollow = (Char) EditorGUILayout.ObjectField ("Character to follow:", charToFollow, typeof(Char), true);

                        if (charToFollow && charToFollow == (Char) npcToMove)
                        {
                            charToFollow = null;
                            Debug.LogWarning ("An NPC cannot follow themselves!");
                        }
                        else
                        {
                            charToFollowID = FieldToID <Char> (charToFollow, charToFollowID);
                            charToFollow = IDToField <Char> (charToFollow, charToFollowID, false);
                        }
                    }

                }

                updateFrequency = EditorGUILayout.FloatField ("Update frequency (s):", updateFrequency);
                if (updateFrequency == 0f || updateFrequency < 0f)
                {
                    EditorGUILayout.HelpBox ("Update frequency must be greater than zero.", MessageType.Warning);
                }
                followDistance = EditorGUILayout.FloatField ("Minimum distance:", followDistance);
                if (followDistance <= 0f)
                {
                    EditorGUILayout.HelpBox ("Minimum distance must be greater than zero.", MessageType.Warning);
                }
                followDistanceMax = EditorGUILayout.FloatField ("Maximum distance:", followDistanceMax);
                if (followDistanceMax <= 0f || followDistanceMax < followDistance)
                {
                    EditorGUILayout.HelpBox ("Maximum distance must be greater than minimum distance.", MessageType.Warning);
                }
            }

            AfterRunningOption ();
        }
コード例 #30
0
		override public void ShowGUI (List<ActionParameter> parameters)
		{
			isPlayer = EditorGUILayout.Toggle ("Is Player?", isPlayer);

			if (!isPlayer)
			{
				charToMoveParameterID = Action.ChooseParameterGUI ("Character to move:", parameters, charToMoveParameterID, ParameterType.GameObject);
				if (charToMoveParameterID >= 0)
				{
					charToMoveID = 0;
					charToMove = null;
				}
				else
				{
					charToMove = (Char) EditorGUILayout.ObjectField ("Character to move:", charToMove, typeof (Char), true);
					
					charToMoveID = FieldToID <Char> (charToMove, charToMoveID);
					charToMove = IDToField <Char> (charToMove, charToMoveID, false);
				}
			}

			markerParameterID = Action.ChooseParameterGUI ("Marker to reach:", parameters, markerParameterID, ParameterType.GameObject);
			if (markerParameterID >= 0)
			{
				markerID = 0;
				marker = null;
			}
			else
			{
				marker = (Marker) EditorGUILayout.ObjectField ("Marker to reach:", marker, typeof (Marker), true);
				
				markerID = FieldToID <Marker> (marker, markerID);
				marker = IDToField <Marker> (marker, markerID, false);
			}

			speed = (PathSpeed) EditorGUILayout.EnumPopup ("Move speed:" , speed);
			pathFind = EditorGUILayout.Toggle ("Pathfind?", pathFind);
			if (!pathFind)
			{
				doFloat = EditorGUILayout.Toggle ("Ignore gravity?", doFloat);
			}
			willWait = EditorGUILayout.Toggle ("Wait until finish?", willWait);

			AfterRunningOption ();
		}
コード例 #31
0
 public override void AssignValues(List<ActionParameter> parameters)
 {
     npcToMove = AssignFile <NPC> (parameters, npcToMoveParameterID, npcToMoveID, npcToMove);
     charToFollow = AssignFile <Char> (parameters, charToFollowParameterID, charToFollowID, charToFollow);
 }
コード例 #32
0
        public void Start()
        {
            // Get and validate the arguments:
            if (!DialogueManager.IsConversationActive)
            {
                if (DialogueDebug.LogWarnings)
                {
                    Debug.LogWarning(string.Format("{0}: Sequencer command ACSpeech({1}): No conversation is active; can't run", DialogueDebug.Prefix, GetParameters()));
                }
                return;
            }
            var subtitle = DialogueManager.CurrentConversationState.subtitle;

            if (subtitle == null)
            {
                if (DialogueDebug.LogWarnings)
                {
                    Debug.LogWarning(string.Format("{0}: Sequencer command ACSpeech({1}): The subtitle record is invalid", DialogueDebug.Prefix, GetParameters()));
                }
                return;
            }
            if (string.IsNullOrEmpty(subtitle.dialogueEntry.DialogueText) && string.Equals(subtitle.dialogueEntry.Title, "START"))
            {
                return;
            }
            var subject = (subtitle.speakerInfo == null) ? null : subtitle.speakerInfo.transform;

            speakerChar = (subject == null) ? null : subject.GetComponent <AC.Char>();
            if (speakerChar == null)
            {
                foreach (var character in FindObjectsOfType <AC.Char>())
                {
                    if (string.Equals(character.name, subtitle.speakerInfo.Name))
                    {
                        speakerChar = character;
                        break;
                    }
                }
            }
            if (speakerChar == null)
            {
                if (DialogueDebug.LogWarnings)
                {
                    Debug.LogWarning(string.Format("{0}: Sequencer command ACSpeech({1}): Speaker character not found", DialogueDebug.Prefix, GetParameters()));
                }
                return;
            }
            var speakerName = speakerChar.name;
            var isPlayer    = (speakerChar.GetComponent <Player>() != null);

            if (isPlayer)
            {
                speakerChar = KickStarter.player;
                if ((KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow || !KickStarter.speechManager.usePlayerRealName))
                {
                    speakerName = "Player";
                }
            }
            var text         = subtitle.formattedText.text;
            var lineID       = GetParameter(0);
            var numberString = lineID.Substring(Mathf.Min(lineID.Length, speakerName.Length));
            var lineNumber   = Tools.StringToInt(numberString);
            //--- No longer used: var language = Options.GetLanguageName();
            var isBackground = string.Equals(GetParameter(1), "nowait", System.StringComparison.OrdinalIgnoreCase);
            var noAnimation  = false;

            Debug.Log(string.Format("{0}: Sequencer command ACSpeech({1}): speaker={2}, lineNumber={3}, text='{4}', isBackground={5}, isPlayer={6}",
                                    DialogueDebug.Prefix, GetParameters(), speakerName, lineNumber, text, isBackground, isPlayer));

            // Hook into AC's EventManager to be notified when speech stops:
            AC.EventManager.OnStopSpeech += OnStopSpeech;

            // Call AC's speech functionality. Credit: Based on AC's ActionSpeech.cs (c) Icebox Studios.
            KickStarter.dialog.KillDialog(false, true);
            KickStarter.dialog.StartDialog(speakerChar, text, isBackground, lineNumber, noAnimation);
        }
コード例 #33
0
 private void OnStopSpeech(AC.Char speakingCharacter)
 {
     Stop();
 }
コード例 #34
0
ファイル: Dialog.cs プロジェクト: Davetheallthing/Space-Walk
        /**
         * <summary>Initialises a new Speech line.</summary>
         * <param name = "_speaker">The speaking character. If null, the line will be treated as narration</param>
         * <param name = "_text">The subtitle text to display</param>
         * <param name = "isBackground">True if the line should play in the background, and not interrupt any Actions or gameplay</param>
         * <param name = "lineID">The ID number of the line, if it is listed in the Speech Manager</param>
         * <param name = "noAnimation">True if the character should not play a talking animation</param>
         * <returns>The generated Speech line</returns>
         */
        public Speech StartDialog(Char _speaker, string _text, bool isBackground = false, int lineID = -1, bool noAnimation = false)
        {
            // Get the language
            string _language = "";
            int lanuageNumber = Options.GetLanguage ();
            if (lanuageNumber > 0)
            {
                // Not in original language, so pull translation in from Speech Manager
                _language = KickStarter.speechManager.languages [lanuageNumber];
            }

            // Remove speaker's previous line
            for (int i=0; i<speechList.Count; i++)
            {
                if (speechList[i].GetSpeakingCharacter () == _speaker)
                {
                    EndSpeech (i);
                    i=0;
                }
            }

            Speech speech = new Speech (_speaker, _text, lineID, _language, isBackground, noAnimation);
            speechList.Add (speech);

            KickStarter.runtimeVariables.AddToSpeechLog (speech.log);
            KickStarter.playerMenus.AssignSpeechToMenu (speech);

            if (speech.hasAudio)
            {
                if (KickStarter.speechManager.relegateBackgroundSpeechAudio)
                {
                    EndBackgroundSpeechAudio (speech);
                }

                KickStarter.stateHandler.UpdateAllMaxVolumes ();
            }

            return speech;
        }
コード例 #35
0
ファイル: ActionCharHold.cs プロジェクト: mcbodge/eidolon
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            isPlayer = EditorGUILayout.Toggle ("Is Player?", isPlayer);
            if (isPlayer)
            {
                if (Application.isPlaying)
                {
                    _char = KickStarter.player;
                }
                else if (AdvGame.GetReferences ().settingsManager)
                {
                    _char = AdvGame.GetReferences ().settingsManager.GetDefaultPlayer ();
                }
                else
                {
                    EditorGUILayout.HelpBox ("A Settings Manager and player must be defined", MessageType.Warning);
                }
            }
            else
            {
                _char = (Char) EditorGUILayout.ObjectField ("Character:", _char, typeof (Char), true);

                _charID = FieldToID <Char> (_char, _charID);
                _char = IDToField <Char> (_char, _charID, true);
            }

            if (_char)
            {
                if (_char.GetAnimEngine () && _char.GetAnimEngine ().ActionCharHoldPossible ())
                {
                    objectToHoldParameterID = Action.ChooseParameterGUI ("Object to hold:", parameters, objectToHoldParameterID, ParameterType.GameObject);
                    if (objectToHoldParameterID >= 0)
                    {
                        objectToHoldID = 0;
                        objectToHold = null;
                    }
                    else
                    {
                        objectToHold = (GameObject) EditorGUILayout.ObjectField ("Object to hold:", objectToHold, typeof (GameObject), true);

                        objectToHoldID = FieldToID (objectToHold, objectToHoldID);
                        objectToHold = IDToField (objectToHold, objectToHoldID, false);
                    }

                    hand = (Hand) EditorGUILayout.EnumPopup ("Hand:", hand);
                    rotate90 = EditorGUILayout.Toggle ("Rotate 90 degrees?", rotate90);
                }
                else
                {
                    EditorGUILayout.HelpBox ("This Action is not compatible with this Character's Animation Engine.", MessageType.Info);
                }
            }
            else
            {
                EditorGUILayout.HelpBox ("This Action requires a Character before more options will show.", MessageType.Info);
            }

            AfterRunningOption ();
        }
コード例 #36
0
ファイル: Dialog.cs プロジェクト: IJkeB/Ekster_Final
        public Speech StartDialog(Char _speaker, string _text, int lineID, string _language, bool isBackground, bool noAnimation)
        {
            // Remove speaker's previous line
            for (int i=0; i<speechList.Count; i++)
            {
                if (speechList[i].GetSpeakingCharacter () == _speaker)
                {
                    EndSpeech (i);
                    i=0;
                }
            }

            Speech speech = new Speech (_speaker, _text, lineID, _language, isBackground, noAnimation);
            speechList.Add (speech);

            KickStarter.runtimeVariables.AddToSpeechLog (speech.log);
            KickStarter.playerMenus.AssignSpeechToMenu (speech);

            if (speech.hasAudio)
            {
                if (KickStarter.speechManager.relegateBackgroundSpeechAudio)
                {
                    EndBackgroundSpeechAudio (speech);
                }

                KickStarter.stateHandler.UpdateAllMaxVolumes ();
            }

            return speech;
        }
コード例 #37
0
 public override void Declare(AC.Char _character)
 {
     character    = _character;
     turningStyle = TurningStyle.RootMotion;
     rootMotion   = true;
 }
コード例 #38
0
        private void Start()
        {
            /*
             * First, we'll assign our private variables, and give warnings if things are not as expected.
             */

            navMeshAgent = GetComponent <NavMeshAgent>();
            originalSpeed = navMeshAgent.speed;
            _char = GetComponent <AC.Char>();

            if (_char == null)
            {
                ACDebug.LogWarning ("A 'Player' or 'NPC' component must be attached to " + gameObject.name + " for the NavMeshAgentIntegration script to work.", gameObject);
            }
            else
            {
                SetMotionControl ();

                /*
                 * Get the player's initial position, based on the appropriate PlayerStart
                 */
                if (KickStarter.sceneSettings && KickStarter.sceneSettings.GetPlayerStart ())
                {
                    targetPosition = KickStarter.sceneSettings.GetPlayerStart ().transform.position;
                }

                /*
                 * If this controls a Player, and the game's Movement method is not Point And Click,
                 * we'll allow regular AC control over movement during gameplay.
                 */
                if (_char is Player && KickStarter.settingsManager != null && KickStarter.settingsManager.movementMethod != MovementMethod.PointAndClick)
                {
                    disableDuringGameplay = true;
                }
            }

            if (KickStarter.sceneSettings != null && KickStarter.sceneSettings.navigationMethod != AC_NavigationMethod.UnityNavigation)
            {
                ACDebug.LogWarning ("For the NavMeshAgentIntegration script to work, your scene's pathfinding method must be set to 'Unity Navigation'");
            }
        }
コード例 #39
0
ファイル: ActionCharMove.cs プロジェクト: mcbodge/eidolon
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            UpgradeSelf ();

            isPlayer = EditorGUILayout.Toggle ("Is Player?", isPlayer);

            if (!isPlayer)
            {
                charToMoveParameterID = Action.ChooseParameterGUI ("Character to move:", parameters, charToMoveParameterID, ParameterType.GameObject);
                if (charToMoveParameterID >= 0)
                {
                    charToMoveID = 0;
                    charToMove = null;
                }
                else
                {
                    charToMove = (Char) EditorGUILayout.ObjectField ("Character to move:", charToMove, typeof (Char), true);

                    charToMoveID = FieldToID <Char> (charToMove, charToMoveID);
                    charToMove = IDToField <Char> (charToMove, charToMoveID, false);
                }
            }

            movePathMethod = (MovePathMethod) EditorGUILayout.EnumPopup ("Method:", movePathMethod);
            if (movePathMethod == MovePathMethod.MoveOnNewPath)
            {
                movePathParameterID = Action.ChooseParameterGUI ("Path to follow:", parameters, movePathParameterID, ParameterType.GameObject);
                if (movePathParameterID >= 0)
                {
                    movePathID = 0;
                    movePath = null;
                }
                else
                {
                    movePath = (Paths) EditorGUILayout.ObjectField ("Path to follow:", movePath, typeof(Paths), true);

                    movePathID = FieldToID <Paths> (movePath, movePathID);
                    movePath = IDToField <Paths> (movePath, movePathID, false);
                }

                doTeleport = EditorGUILayout.Toggle ("Teleport to start?", doTeleport);
                if (movePath != null && movePath.pathType != AC_PathType.ForwardOnly)
                {
                    willWait = false;
                }
                else
                {
                    willWait = EditorGUILayout.Toggle ("Wait until finish?", willWait);
                }

                if (movePath != null && movePath.GetComponent <Char>())
                {
                    EditorGUILayout.HelpBox ("Can't follow a Path attached to a Character!", MessageType.Warning);
                }
            }
            else if (movePathMethod == MovePathMethod.ResumeLastSetPath)
            {
                //
            }

            AfterRunningOption ();
        }