Skip to content

Commit

Permalink
Supply tooltips.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Apr 1, 2019
1 parent b944b06 commit 433ae40
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace JCSUnity
{
/// <summary>
/// Action does the fly action on 2D.
/// Action does the AI fly action on 2D.
/// </summary>
[RequireComponent(typeof(JCS_CharacterControllerInfo))]
[RequireComponent(typeof(JCS_VelocityInfo))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
namespace JCSUnity
{
/// <summary>
/// Simulate the AI to do jump base on
/// the random possiblity time zone.
/// Action does the AI jump action in 2D.
/// </summary>
[RequireComponent(typeof(JCS_CharacterControllerInfo))]
[RequireComponent(typeof(JCS_VelocityInfo))]
Expand Down Expand Up @@ -72,13 +71,13 @@ [SerializeField] [Range(0.0f, 3.0f)]
[Tooltip(@"Addition value to the jump force. For
instance value 5, will generate -5 ~ 5 and add it on to current jump force.")]
[SerializeField]
[Range(1, 10)]
private float mRandomJumpForceRange = 5;
[Range(1.0f, 10.0f)]
private float mRandomJumpForceRange = 5.0f;


[Header("** Optional Settings (JCS_2DJumpAction) **")]

[Tooltip("Plz fill this is there is animation going on to this game object.")]
[Tooltip("Live object animation.")]
// Animator in order to set the animation.
[SerializeField]
private JCS_2DLiveObjectAnimator mLiveObjectAnimator = null;
Expand Down Expand Up @@ -156,6 +155,9 @@ private void Update()
//----------------------
// Public Functions

/// <summary>
/// Do the jump by possibility.
/// </summary>
public void JumpByPossibility()
{
float possibility = JCS_Random.Range(0, 100);
Expand All @@ -165,6 +167,10 @@ public void JumpByPossibility()

Jump();
}

/// <summary>
/// Do the jump action.
/// </summary>
public void Jump()
{
Jump(mJumpForce);
Expand Down Expand Up @@ -199,7 +205,7 @@ public void Jump(float force)
// Private Functions

/// <summary>
///
/// Do jump implementation.
/// </summary>
/// <returns> true: do jump, flase: dont do jump </returns>
private void DoJump()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* $Date: $
* $Revision: $
* $Creator: Jen-Chieh Shen $
* $Notice: See LICENSE.txt for modification and distribution information
* $Notice: See LICENSE.txt for modification and distribution information
* Copyright (c) 2016 by Shen, Jen-Chieh $
*/
using UnityEngine;
Expand All @@ -13,7 +13,7 @@
namespace JCSUnity
{
/// <summary>
/// Simulate swim action in 2d.
/// Action does the AI swim action in 2D.
/// </summary>
public class JCS_2DSwimAction
: JCS_AIAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* $Date: $
* $Revision: $
* $Creator: Jen-Chieh Shen $
* $Notice: See LICENSE.txt for modification and distribution information
* $Notice: See LICENSE.txt for modification and distribution information
* Copyright (c) 2016 by Shen, Jen-Chieh $
*/
using UnityEngine;
Expand All @@ -13,7 +13,7 @@
namespace JCSUnity
{
/// <summary>
/// Simulate the walk action by the character itself.
/// Action does the AI walk action in 2D.
/// </summary>
[RequireComponent(typeof(JCS_CharacterControllerInfo))]
[RequireComponent(typeof(JCS_VelocityInfo))]
Expand All @@ -38,14 +38,12 @@ public enum Status

private JCS_VelocityInfo mVelocityInfo = null;


[Header("** Runtime Varaibles (JCS_2DWalkAction) **")]

[Tooltip("Speed of the action. (walk action)")]
[Tooltip("Speed of the action.")]
[SerializeField]
private float mWalkSpeed = 10;


[Header("** Activate Variables **")]
private float mWalkSpeed = 10.0f;

[Tooltip("Possibility to walk LEFT way.")]
[SerializeField] [Range(0.0f, 100.0f)]
Expand All @@ -64,7 +62,7 @@ [SerializeField] [Range(0.0f, 100.0f)]
private float mPossibility = 80.0f;


[Header("** Time Settings **")]
[Header("** Time Settings (JCS_2DWalkAction) **")]

[Tooltip("Time to do one walk.")]
[SerializeField] [Range(0.0f, 10.0f)]
Expand All @@ -74,7 +72,7 @@ [SerializeField] [Range(0.0f, 10.0f)]
[SerializeField] [Range(0.0f, 3.0f)]
private float mAdjustTimeZone = 1.5f;

// time to record down the real time to do one walk
// time to record down the real time to do one walk
// action after we calculate the real time.
private float mRealTimeZone = 0;

Expand All @@ -91,16 +89,15 @@ [SerializeField] [Range(0.0f, 3.0f)]
[SerializeField]
private bool mStartRandomWalkSpeed = false;

[Tooltip(@"Addition value to the walk speed. For
[Tooltip(@"Addition value to the walk speed. For
instance value 5, will generate -5 ~ 5 and add it on to current walk speed.")]
[SerializeField] [Range(1, 10)]
private float mRandomWalkSpeedRange = 5;


[Header("** Track Effect (JCS_2DWalkAction) **")]

[Tooltip(@"Check weather the this object get mad or not. If
the get mad will start tracking the object that make this object mad.")]
[Tooltip("If get mad will start tracking the object that make this object mad.")]
[SerializeField]
private bool mMadEffect = true;

Expand All @@ -111,7 +108,7 @@ [SerializeField] [Range(1, 10)]

[Header("** Optional Settings (JCS_2DWalkAction) **")]

[Tooltip("Plz fill this is there is animation going on to this game object.")]
[Tooltip("Live object animation.")]
[SerializeField]
private JCS_2DLiveObjectAnimator mLiveObjectAnimator = null;

Expand All @@ -133,7 +130,7 @@ [SerializeField] [Range(1, 10)]
public float RecordSpeedY { get { return this.mVelocityInfo.RecordSpeed.y; } set { this.mVelocityInfo.RecordSpeedY = value; } }
public float RecordSpeedZ { get { return this.mVelocityInfo.RecordSpeed.z; } set { this.mVelocityInfo.RecordSpeedZ = value; } }

// Track Effects
// Track Effects
public bool MadEffect { get { return this.mMadEffect; } set { this.mMadEffect = value; } }

//========================================
Expand Down Expand Up @@ -171,7 +168,7 @@ private void Update()
// Public Functions

/// <summary>
/// Calculate the possiblity and see if do the walk action.
/// Do the walk action depends on possibility.
/// </summary>
public void WalkByPossiblity()
{
Expand All @@ -182,7 +179,7 @@ public void WalkByPossiblity()
return;

// start the algorithm to see if we
// find the direction to do,
// find the direction to do,
// if not it will just go randomly.
WalkDirectionPossibility();
}
Expand All @@ -195,18 +192,18 @@ public void WalkDirectionPossibility()
{
// direction we are going to use next.
Status direction = Status.IDLE;


// if is already get attack do the mad effect.
if (mMadEffect && mAttackRecorder != null)
{
Transform lastAttacker = mAttackRecorder.LastAttacker;

// if the last attacker does not exist,
// if the last attacker does not exist,
// do nothing.
if (lastAttacker != null)
{
// if does exist, start following
// if does exist, start following
// the attacker.
if (lastAttacker.position.x < this.transform.position.x)
direction = Status.LEFT;
Expand Down Expand Up @@ -239,7 +236,7 @@ public void WalkDirectionPossibility()
direction = Status.LEFT;
++resultCounter;
}

if (rightPossiblity < mToRight)
{
// success to do right
Expand All @@ -259,21 +256,21 @@ public void WalkDirectionPossibility()
/// <summary>
/// Sometimes if the algorithm cannot find which direction to go.
/// Just use the function instead of keep finding the direction.
///
///
/// For example, all three possiblity (Idle, Left, Right)
/// can be set to 100 percent. Than it will always have to
/// can be set to 100 percent. Than it will always have to
/// possiblity of direction to go, which mean the object could
/// not decide which direction to go.
/// </summary>
public void WalkRandomly()
{
int result = JCS_Random.Range(-1, 1 + 1);

WalkByStatus(result);
}

/// <summary>
///
/// Walk depends on the status.
/// </summary>
/// <param name="direction"></param>
public void WalkByStatus(int direction)
Expand All @@ -282,7 +279,7 @@ public void WalkByStatus(int direction)
}

/// <summary>
///
/// Walk depends on the status.
/// </summary>
/// <param name="status"></param>
public void WalkByStatus(Status status)
Expand Down Expand Up @@ -364,7 +361,7 @@ private void DoWalk()
}

/// <summary>
/// Algorithm to calculate the time to do
/// Algorithm to calculate the time to do
/// walk action include direction.
/// </summary>
private void ResetTimeZone()
Expand Down

0 comments on commit 433ae40

Please sign in to comment.