public override void OnReset()
 {
     targetGameObject = null;
     force = Vector3.zero;
     position = Vector3.zero;
     forceMode = ForceMode.Force;
 }
示例#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
     }
 }
示例#3
0
 public override void OnReset()
 {
     targetGameObject = null;
     point = Vector3.zero;
     axis = Vector3.zero;
     angle = 0;
 }
示例#4
0
 public override void OnReset()
 {
     start = Vector3.zero;
     end = Vector3.zero;
     color = Color.white;
     duration = 0f;
     depthTest = true;
 }
示例#5
0
 public override void OnReset()
 {
     targetGameObject = null;
     targetObject = null;
     targetPosition = Vector3.zero;
     ignoreHeight = true;
     storeValue = 0;
 }
示例#6
0
 // Reset the public variables
 public override void OnReset()
 {
     usePhysics2D = false;
     rotationEpsilon = 0.5f;
     maxLookAtRotationDelta = 1f;
     onlyY = false;
     target = null;
     targetRotation = Vector3.zero;
 }
示例#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"];
    }
示例#9
0
 public override void OnReset()
 {
     targetGameObject = null;
     explosionForce = 0;
     explosionPosition = Vector3.zero;
     explosionRadius = 0;
     upwardsModifier = 0;
     forceMode = ForceMode.Force;
 }
示例#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);

    }
示例#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;
 }
示例#14
0
 // Reset the public variables
 public override void OnReset()
 {
     fieldOfViewAngle = 90;
     viewDistance = 1000;
     offset = Vector3.zero;
 }
示例#15
0
 public override void OnReset()
 {
     targetGameObject = null;
     translation = Vector3.zero;
     relativeTo = Space.Self;
 }
示例#16
0
 public override void OnReset()
 {
     operation    = Operation.Add;
     firstVector3 = secondVector3 = storeResult = Vector3.zero;
 }
示例#17
0
文件: Multiply.cs 项目: dev-celvin/DK
 public override void OnReset()
 {
     vector3Variable = storeResult = Vector3.zero;
     multiplyBy = 0;
 }
示例#18
0
 public virtual void OnReset()
 {
     this.targetGameObject = (SharedGameObject)null;
     this.translation      = (SharedVector3)Vector3.get_zero();
     this.relativeTo       = (Space)1;
 }
示例#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;
 }
示例#22
0
 public override void OnReset()
 {
     targetGameObject = null;
     position         = Vector3.zero;
     rotation         = Quaternion.identity;
 }
示例#23
0
 public override void OnReset()
 {
     targetGameObject = null;
     allowEmptyTarget = false;
     storeValue       = Vector3.zero;
 }
示例#24
0
 public override void OnReset()
 {
     base.OnReset();
     target         = null;
     targetPosition = Vector3.zero;
 }
示例#25
0
 public override void OnReset()
 {
     targetPosition = Vector3.zero;
     speed          = 0;
 }
示例#26
0
 public override void OnReset()
 {
     vector3Value    = Vector3.zero;
     vector3Variable = Vector3.zero;
 }
示例#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;
 }
示例#29
0
 public override void OnReset()
 {
     vector3Variable = Vector3.zero;
     storeX          = storeY = storeZ = 0;
 }
示例#30
0
 public virtual void OnReset()
 {
     this.firstVector3 = this.secondVector3 = (SharedVector3)Vector3.get_zero();
     this.storeResult  = (SharedFloat)0.0f;
 }
示例#31
0
 public virtual void OnReset()
 {
     this.targetGameObject = (SharedGameObject)null;
     this.velocity         = (SharedVector3)Vector3.get_zero();
 }
示例#32
0
 public virtual void OnReset()
 {
     this.vector3Variable = (SharedVector3)Vector3.get_zero();
     this.storeResult     = (SharedFloat)0.0f;
 }
示例#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);
        }
示例#34
0
 public override void OnReset()
 {
     this.targetGameObject = null;
     this.position         = Vector3.zero;
 }
示例#35
0
 public virtual void OnReset()
 {
     this.storeValue = (SharedVector3)Vector3.get_zero();
 }
示例#36
0
 public override void OnReset()
 {
     fromDirection = toDirection = Vector3.zero;
     storeResult = Quaternion.identity;
 }
示例#37
0
 public override void OnReset()
 {
     targetGameObject = null;
     localPosition = Vector3.zero;
 }
示例#38
0
 public override void OnReset()
 {
     targetGameObject = null;
     position = Vector3.zero;
     rotation = Quaternion.identity;
 }
示例#39
0
 public override void OnReset()
 {
     storeResult = Vector3.zero;
 }
 public override void OnReset()
 {
     targetGameObject = null;
     destination = Vector3.zero;
 }
示例#41
0
 public override void OnReset()
 {
     eulerVector = Vector3.zero;
     storeResult = Quaternion.identity;
 }
示例#42
0
 public override void OnReset()
 {
     targetGameObject = null;
     velocity         = Vector3.zero;
 }
示例#43
0
 public override void OnReset()
 {
     targetGameObject = null;
     eulerAngles = Vector3.zero;
     relativeTo = Space.Self;
 }
示例#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;
 }
示例#47
0
 public override void OnReset()
 {
     targetGameObject = null;
     angularVelocity = Vector3.zero;
 }
示例#48
0
 public override void OnReset()
 {
     targetGameObject = null;
     localPosition    = Vector3.zero;
 }
示例#49
0
 public override void OnReset()
 {
     targetGameObject = null;
     eulerAngles = Vector3.zero;
 }
示例#50
0
 public override void OnReset()
 {
     targetVariable = Vector3.zero;
 }
示例#51
0
 public override void OnReset()
 {
     base.OnReset();
     target = null;
     targetPosition = Vector3.zero;
 }
 public override void OnReset()
 {
     storeResult = Vector3.zero;
 }
示例#53
0
 public override void OnReset()
 {
     currentPosition = targetPosition = storeResult = Vector3.zero;
     speed = 0;
 }
示例#54
0
 public virtual void OnReset()
 {
     this.targetGameObject = (SharedGameObject)null;
     this.position         = (SharedVector3)Vector3.get_zero();
     this.rotation         = (SharedQuaternion)Quaternion.get_identity();
 }
示例#55
0
 public override void OnReset()
 {
     targetGameObject = null;
     storeValue       = Vector3.zero;
 }
示例#56
0
 public override void OnReset()
 {
     start     = Vector3.zero;
     direction = Vector3.zero;
     color     = Color.white;
 }
示例#57
0
 public override void OnReset()
 {
     targetGameObject = null;
     speed = Vector3.zero;
 }
示例#58
0
 public override void OnReset()
 {
     targetGameObject = null;
     center           = Vector3.zero;
 }
示例#59
0
 public override void OnReset()
 {
     targetGameObject = null;
     storeValue = Vector3.zero;
 }
示例#60
0
 public override void OnReset()
 {
     this.targetGameObject = null;
     this.angularVelocity  = Vector3.zero;
 }