public override void OnReset()
 {
     targetGameObject = null;
     force = Vector3.zero;
     position = Vector3.zero;
     forceMode = ForceMode.Force;
 }
Example #2
0
 public override void OnStart()
 {
     if ((targetTransform == null || targetTransform.Value == null) && targetPosition == null) {
         Debug.LogError("Error: A MoveTowards target value is not set.");
         targetPosition = new SharedVector3(); // create a new SharedVector3 to prevent repeated errors
     }
 }
Example #3
0
 public override void OnReset()
 {
     targetGameObject = null;
     point = Vector3.zero;
     axis = Vector3.zero;
     angle = 0;
 }
Example #4
0
 public override void OnReset()
 {
     start = Vector3.zero;
     end = Vector3.zero;
     color = Color.white;
     duration = 0f;
     depthTest = true;
 }
Example #5
0
 public override void OnReset()
 {
     targetGameObject = null;
     targetObject = null;
     targetPosition = Vector3.zero;
     ignoreHeight = true;
     storeValue = 0;
 }
Example #6
0
 // Reset the public variables
 public override void OnReset()
 {
     usePhysics2D = false;
     rotationEpsilon = 0.5f;
     maxLookAtRotationDelta = 1f;
     onlyY = false;
     target = null;
     targetRotation = Vector3.zero;
 }
Example #7
0
 public override void OnReset()
 {
     originGameObject = null;
     originPosition = Vector3.zero;
     direction = Vector3.zero;
     distance = -1;
     layerMask = -1;
     space = Space.Self;
 }
    public override void OnAwake()
    {
        //birthPos = (SharedVector3)GlobalVariables.Instance.GetVariable("MonsterBirth_Pos");
        birthPos = (SharedVector3)Owner.GetVariable("MonsterBirth_Pos");

        gameObject.transform.position = birthPos.Value;

        state = gameObject.animation["f_out"];
    }
Example #9
0
 public override void OnReset()
 {
     targetGameObject = null;
     explosionForce = 0;
     explosionPosition = Vector3.zero;
     explosionRadius = 0;
     upwardsModifier = 0;
     forceMode = ForceMode.Force;
 }
Example #10
0
 public override void OnReset()
 {
     targetGameObject = null;
     matchPosition = Vector3.zero;
     matchRotation = Quaternion.identity;
     targetBodyPart = AvatarTarget.Root;
     weightMaskPosition = Vector3.zero;
     weightMaskRotation = 0;
     startNormalizedTime = 0;
     targetNormalizedTime = 1;
 }
    public override void OnStart()
    {
        targetPosition = (SharedVector3)Owner.GetVariable("MonsterMovement_Target");

        if ((targetTransform == null || targetTransform.Value == null) && targetPosition == null)
        {
            Debug.LogError("Error: A MoveTowards target value is not set.");
            targetPosition = new SharedVector3(); // create a new SharedVector3 to prevent repeated errors
        }

        gameObject.animation.Play(state.clip.name, PlayMode.StopAll);

    }
Example #12
0
        public override TaskStatus OnUpdate()
        {
            Vector3 position;
            Vector3 dir = direction.Value;
            if (originGameObject.Value != null) {
                position = originGameObject.Value.transform.position;
                if (space == Space.Self) {
                    dir = originGameObject.Value.transform.TransformDirection(direction.Value);
                }
            } else {
                position = originPosition.Value;
            }

            RaycastHit hit;
            if (Physics.Raycast(position, dir, out hit, distance.Value == -1 ? Mathf.Infinity : distance.Value, layerMask)) {
                storeHitObject = hit.collider.gameObject;
                storeHitPoint = hit.point;
                storeHitNormal = hit.normal;
                storeHitDistance = hit.distance;
                return TaskStatus.Success;
            }

            return TaskStatus.Failure;
        }
 public override void OnReset()
 {
     variable = Vector3.zero;
     compareTo = Vector3.zero;
 }
 // Reset the public variables
 public override void OnReset()
 {
     fieldOfViewAngle = 90;
     viewDistance = 1000;
     offset = Vector3.zero;
 }
Example #15
0
 public override void OnReset()
 {
     targetGameObject = null;
     translation = Vector3.zero;
     relativeTo = Space.Self;
 }
Example #16
0
 public override void OnReset()
 {
     operation    = Operation.Add;
     firstVector3 = secondVector3 = storeResult = Vector3.zero;
 }
Example #17
0
 public override void OnReset()
 {
     vector3Variable = storeResult = Vector3.zero;
     multiplyBy = 0;
 }
Example #18
0
 public virtual void OnReset()
 {
     this.targetGameObject = (SharedGameObject)null;
     this.translation      = (SharedVector3)Vector3.get_zero();
     this.relativeTo       = (Space)1;
 }
Example #19
0
 public override void OnReset()
 {
     position = Vector3.zero;
 }
 public override void OnReset()
 {
     targetGameObject = null;
     torque           = Vector3.zero;
     forceMode        = ForceMode.Force;
 }
 public override void OnReset()
 {
     vector3Variable = Vector3.zero;
     storeResult     = 0;
 }
Example #22
0
 public override void OnReset()
 {
     targetGameObject = null;
     position         = Vector3.zero;
     rotation         = Quaternion.identity;
 }
Example #23
0
 public override void OnReset()
 {
     targetGameObject = null;
     allowEmptyTarget = false;
     storeValue       = Vector3.zero;
 }
Example #24
0
 public override void OnReset()
 {
     base.OnReset();
     target         = null;
     targetPosition = Vector3.zero;
 }
Example #25
0
 public override void OnReset()
 {
     targetPosition = Vector3.zero;
     speed          = 0;
 }
Example #26
0
 public override void OnReset()
 {
     vector3Value    = Vector3.zero;
     vector3Variable = Vector3.zero;
 }
Example #27
0
 public virtual void OnReset()
 {
     this.operation    = Operator.Operation.Add;
     this.firstVector3 = this.secondVector3 = this.storeResult = (SharedVector3)Vector3.get_zero();
 }
 public override void OnReset()
 {
     currentRotation = targetRotation = storeResult = Vector3.zero;
     maxDegreesDelta = maxMagnitudeDelta = 0;
 }
Example #29
0
 public override void OnReset()
 {
     vector3Variable = Vector3.zero;
     storeX          = storeY = storeZ = 0;
 }
Example #30
0
 public virtual void OnReset()
 {
     this.firstVector3 = this.secondVector3 = (SharedVector3)Vector3.get_zero();
     this.storeResult  = (SharedFloat)0.0f;
 }
Example #31
0
 public virtual void OnReset()
 {
     this.targetGameObject = (SharedGameObject)null;
     this.velocity         = (SharedVector3)Vector3.get_zero();
 }
Example #32
0
 public virtual void OnReset()
 {
     this.vector3Variable = (SharedVector3)Vector3.get_zero();
     this.storeResult     = (SharedFloat)0.0f;
 }
Example #33
0
        // Move towards the destination. Return success once we have reached the destination. Return failure if the destination has respawned and we no longer should be seeking it.
        // Will return running if we are currently seeking
        public override TaskStatus OnUpdate()
        {
            // use the nav agent's destination position if we are on an alternate path or the target is null. We are using an alternate path if the previous path would have collided with
            // an object on defense. target will be null when we are seeking a position specified by the position variable
            var targetPosition = (alternatePath || target.Value == null ? navMeshAgent.destination : target.Value.position);

            targetPosition.y = navMeshAgent.destination.y; // ignore y

            // we can only arrive if the path isn't pending
            if (!navMeshAgent.pathPending)
            {
                var thisPosition = transform.position;
                thisPosition.y = targetPosition.y;
                // If the magnitude is less than the arrive magnitude then we have arrived at the destination
                if (Vector3.SqrMagnitude(thisPosition - navMeshAgent.destination) < SampleConstants.ArriveMagnitude)
                {
                    // If we arrived from an alternate path then switch back to the regular path
                    if (alternatePath)
                    {
                        alternatePath  = false;
                        targetPosition = target.Value.position;
                    }
                    else
                    {
                        // return success if we don't need to rotate to the target or we are already at the target's rotation
                        if (!rotateToTarget || transform.rotation == target.Value.rotation)
                        {
                            return(TaskStatus.Success);
                        }
                        // not done yet. still need to rotate
                        transform.rotation = Quaternion.RotateTowards(transform.rotation, target.Value.rotation, rotationSpeed.Value * Time.deltaTime);
                    }
                }

                // fail if the target moved too quickly in one frame. This happens after the target has been caught and respawns
                float distance;
                if (prevMagnitude * 2 < (distance = Vector3.SqrMagnitude(thisPosition - targetPosition)))
                {
                    return(TaskStatus.Failure);
                }
                prevMagnitude = distance;
            }

            // try not to head directly for a defensive object
            RaycastHit hit;
            Vector3    hitPoint;

            if (avoidDefeneUnits && (rayCollision(transform.position - transform.right, targetPosition, out hit) ||
                                     rayCollision(transform.position + transform.right, targetPosition, out hit)))
            {
                // looks like an object is within the path. Avoid the object by setting a new destination towards the right of the object that we would have hit
                hitPoint   = hit.point + transform.right * 5;
                hitPoint.y = transform.position.y;
                navMeshAgent.destination = hitPoint;
                // The avoid object may still be in the way even though we moved to the right of the object. If this is the case then move to the left and hope that works
                if (rayCollision(transform.position, navMeshAgent.destination, out hit))
                {
                    hitPoint   = hit.point - transform.right * 5;
                    hitPoint.y = transform.position.y;
                    navMeshAgent.destination = hitPoint;
                }

                // remember that we are taking an alternate path to prevent the agent from jittering back and forth
                alternatePath = true;
                var thisPosition = transform.position;
                thisPosition.y = hitPoint.y;
                prevMagnitude  = Vector3.SqrMagnitude(thisPosition - hitPoint);
            }
            else if (navMeshAgent.destination != targetPosition)
            {
                // the target position has changed since we last set the destination. Update the destination
                navMeshAgent.destination = targetPosition;
            }

            return(TaskStatus.Running);
        }
Example #34
0
 public override void OnReset()
 {
     this.targetGameObject = null;
     this.position         = Vector3.zero;
 }
Example #35
0
 public virtual void OnReset()
 {
     this.storeValue = (SharedVector3)Vector3.get_zero();
 }
Example #36
0
 public override void OnReset()
 {
     fromDirection = toDirection = Vector3.zero;
     storeResult = Quaternion.identity;
 }
Example #37
0
 public override void OnReset()
 {
     targetGameObject = null;
     localPosition = Vector3.zero;
 }
Example #38
0
 public override void OnReset()
 {
     targetGameObject = null;
     position = Vector3.zero;
     rotation = Quaternion.identity;
 }
Example #39
0
 public override void OnReset()
 {
     storeResult = Vector3.zero;
 }
 public override void OnReset()
 {
     targetGameObject = null;
     destination = Vector3.zero;
 }
 public override void OnReset()
 {
     eulerVector = Vector3.zero;
     storeResult = Quaternion.identity;
 }
Example #42
0
 public override void OnReset()
 {
     targetGameObject = null;
     velocity         = Vector3.zero;
 }
Example #43
0
 public override void OnReset()
 {
     targetGameObject = null;
     eulerAngles = Vector3.zero;
     relativeTo = Space.Self;
 }
Example #44
0
 public override void OnReset()
 {
     vector3Variable = Vector2.zero;
     storeResult = Vector3.zero;
 }
 public virtual void OnReset()
 {
     this.targetGameObject = (SharedGameObject)null;
     this.eulerAngles      = (SharedVector3)Vector3.get_zero();
 }
 public override void OnReset()
 {
     target             = null;
     thePosition        = Vector3.zero;
     distanceMultiplier = 2;
 }
Example #47
0
 public override void OnReset()
 {
     targetGameObject = null;
     angularVelocity = Vector3.zero;
 }
Example #48
0
 public override void OnReset()
 {
     targetGameObject = null;
     localPosition    = Vector3.zero;
 }
Example #49
0
 public override void OnReset()
 {
     targetGameObject = null;
     eulerAngles = Vector3.zero;
 }
Example #50
0
 public override void OnReset()
 {
     targetVariable = Vector3.zero;
 }
Example #51
0
 public override void OnReset()
 {
     base.OnReset();
     target = null;
     targetPosition = Vector3.zero;
 }
 public override void OnReset()
 {
     storeResult = Vector3.zero;
 }
Example #53
0
 public override void OnReset()
 {
     currentPosition = targetPosition = storeResult = Vector3.zero;
     speed = 0;
 }
Example #54
0
 public virtual void OnReset()
 {
     this.targetGameObject = (SharedGameObject)null;
     this.position         = (SharedVector3)Vector3.get_zero();
     this.rotation         = (SharedQuaternion)Quaternion.get_identity();
 }
Example #55
0
 public override void OnReset()
 {
     targetGameObject = null;
     storeValue       = Vector3.zero;
 }
Example #56
0
 public override void OnReset()
 {
     start     = Vector3.zero;
     direction = Vector3.zero;
     color     = Color.white;
 }
Example #57
0
 public override void OnReset()
 {
     targetGameObject = null;
     speed = Vector3.zero;
 }
Example #58
0
 public override void OnReset()
 {
     targetGameObject = null;
     center           = Vector3.zero;
 }
Example #59
0
 public override void OnReset()
 {
     targetGameObject = null;
     storeValue = Vector3.zero;
 }
Example #60
0
 public override void OnReset()
 {
     this.targetGameObject = null;
     this.angularVelocity  = Vector3.zero;
 }