override public void Think(Bodies.BaseBody body) { IJump bodyJump = body as IJump; IMoveX bodyMoveX = body as IMoveX; IMoveY bodyMoveY = body as IMoveY; if (bodyJump != null) { if (Input.GetButtonDown(jumpButtonName)) { bodyJump.JumpBegin(); } else if (Input.GetButtonUp(jumpButtonName)) { bodyJump.JumpEnd(); } } if (bodyMoveX != null) { bodyMoveX.MoveX(Input.GetAxis(xAxisName)); } if (bodyMoveY != null) { bodyMoveY.MoveY(Input.GetAxis(yAxisName)); } }
override public void Think(Bodies.BaseBody body) { if (chaseTarget.constValue != null) { //IJump bodyJump = body as IJump; IMoveX bodyMoveX = body as IMoveX; IHaveDirections directions = body as IHaveDirections; if (bodyMoveX != null) { if (body.transform.position.x - chaseTarget.constValue.position.x > 0) { bodyMoveX.MoveX(-1f); } else if (body.transform.position.x - chaseTarget.constValue.position.x < 0) { bodyMoveX.MoveX(1f); } } if (directions != null) { //Debug.Log(directions.forward); Vector3 heading = chaseTarget.constValue.position - body.transform.position; float dot = Vector3.Dot(heading, directions.forward); Debug.Log(dot); //Debug.Log(directions.right); } } }
override public void Initialize(Bodies.BaseBody body) { body.InitMemory(); body.Remember("patrolStart", body.transform.position); body.Remember("patrolEnd", body.transform.position + new Vector3(patrolLength.constValue, 0, 0)); //body.Remember("currentTarget", body.Remember<Vector3>("patrolEnd")); body.Remember("goingToEnd", true); }
override public void Initialize(Bodies.BaseBody body) { }
/// <summary> /// Initializes the brain based on the given body. /// </summary> /// <param name="body">Body which contains the this brain.</param> abstract public void Initialize(Bodies.BaseBody body);
/// <summary> /// Run the think cycle. Should be called in the Update loop. /// </summary> /// <param name="body">Body which contains the this brain.</param> abstract public void Think(Bodies.BaseBody body);