public virtual void Awake() { //we're guaranteed to have this rb = gameObject.GetOrAdd <Rigidbody> (); rb.interpolation = RigidbodyInterpolation.None; rb.useGravity = false; rb.isKinematic = true; gameObject.layer = Globals.LayerNumBodyPart; NObject = gameObject.GetComponent <TNObject> (); MovementPivot = transform; if (RotationPivot == null) { RotationPivot = MovementPivot; } MovementPivot.localRotation = Quaternion.identity; RotationPivot.localRotation = Quaternion.identity; // _worldBodyNetworkUpdateTime = NetworkManager.WorldBodyUpdateRate; // _bodyAnimatorNetworkUpdateTime = NetworkManager.BodyAnimatorUpdateRate; Animator = gameObject.GetComponent <BodyAnimator> (); Animator.animator = gameObject.GetComponent <Animator> (); if (Animator.animator == null) { Animator.animator = RotationPivot.gameObject.GetComponent <Animator> (); } Transforms = gameObject.GetComponent <BodyTransforms> (); Sounds = gameObject.GetComponent <BodySounds> (); if (Sounds != null) { Sounds.Animator = Animator; } SetVisible(false); IgnoreCollisions(true); }
public override void Update() { //If the player is in range, then the enemy will go towards them if (((Mathf.Abs(XDistance) <= DistanceThreshold) || (Mathf.Abs(YDistance) <= DistanceThreshold))) { PolyNavagent.SetDestination(Player.transform.position); PolyNavagent.stoppingDistance = 0.25f; PatrolWayPoints.enabled = false; BodyAnimator.SetBool("IsAttacking", true); } else //If not will continue to do their thing { PolyNavagent.SetDestination(PatrolWayPoints.WPoints[PatrolWayPoints.currentIndex]); PolyNavagent.stoppingDistance = 0.001f; PatrolWayPoints.enabled = true; BodyAnimator.SetBool("IsAttacking", false); } if ((Mathf.Abs(XDistance) <= 0.75f) && (Mathf.Abs(YDistance) <= 0.75f) && CanShoot == true) { Debug.Log("Found You"); GameObject Cat = Instantiate(Projectile, SpawnPoint.transform.position, SpawnPoint.transform.rotation) as GameObject; Cat.GetComponent <Rigidbody2D>().AddForce(transform.up * 100, ForceMode2D.Force); Destroy(Cat, 4f); CanShoot = false; Invoke("CanShootRecover", RateOfFire); } base.Update(); }
public BodyAnimatorUpdate(BodyAnimator target) { BaseMovementMode = target.BaseMovementMode; OverrideMovementMode = target.BaseMovementMode; VerticalAxisMovement = target.VerticalAxisMovement; HorizontalAxisMovement = target.HorizontalAxisMovement; TakingDamage = target.TakingDamage; Dead = target.Dead; Warn = target.Warn; Attack1 = target.Attack1; Attack2 = target.Attack2; Grounded = target.Grounded; Jump = target.Jump; Paused = target.Paused; Idling = target.Idling; }
public override void Update() { //If the player is in range, then the enemy will go towards them if ((Mathf.Abs(XDistance) <= DistanceThreshold) && (Mathf.Abs(YDistance) <= DistanceThreshold)) { PolyNavagent.SetDestination(Player.transform.position); PatrolWayPoints.enabled = false; BodyAnimator.SetBool("IsAttacking", true); } else //If not will continue to do their thing { PolyNavagent.SetDestination(PatrolWayPoints.WPoints[PatrolWayPoints.currentIndex]); PatrolWayPoints.enabled = true; BodyAnimator.SetBool("IsAttacking", false); } base.Update(); }
private void ResetAnimations() { for (int i = 0; i < HandAnimators.Length; i++) { for (int j = 0; j < HandAnimators[i].parameters.Length; j++) { HandAnimators[i].ResetTrigger(HandAnimators[i].parameters[j].name); } HandAnimators[i].SetTrigger(DeathAnimationResetTrigger); } for (int j = 0; j < BodyAnimator.parameters.Length; j++) { BodyAnimator.ResetTrigger(BodyAnimator.parameters[j].name); } BodyAnimator.SetTrigger(DeathAnimationResetTrigger); }
public override void Tick(Rot4 bodyFacing, PawnGraphicSet graphics) { base.Tick(bodyFacing, graphics); BodyAnimator animator = this.CompAnimator.BodyAnimator; if (animator != null) { animator.IsPosing(out this._animatedPercent); } // var curve = bodyFacing.IsHorizontal ? this.walkCycle.BodyOffsetZ : this.walkCycle.BodyOffsetVerticalZ; bool pawnInEditor = HarmonyPatchesFS.AnimatorIsOpen() && MainTabWindow_BaseAnimator.Pawn == this.Pawn; if (!Find.TickManager.Paused || pawnInEditor) { this.SelectWalkcycle(pawnInEditor); this.SelectPosecycle(); this.CompAnimator.FirstHandPosition = Vector3.zero; this.CompAnimator.SecondHandPosition = Vector3.zero; } }