public virtual HitReaction Hurt(Vector3 center, Vector3 forward, Vector3 right, HitInfo hitInfo) { HitReaction hr = new HitReaction(); hr.reactionType = HitReactionType.Hit; return(hr); }
public HumanoidDamageModule(float health, RagdollUtility ragdoll, HitReaction hitReaction, HumanoidAnimationModule animationModule, Transform headTransfrom, Transform chestTransfrom, OnDestoryDeligate onDestroyCallback, Outline outline) : base(health, onDestroyCallback, outline) { m_ragdoll = ragdoll; m_hitReaction = hitReaction; m_headTransform = headTransfrom; m_chestTransform = chestTransfrom; m_animationSystem = animationModule; }
public virtual HitReaction Hurt(HurtInfoBase hurtInfoBase) { HitReaction hr = new HitReaction(); hr.reactionType = HitReactionType.Hit; OnHit?.Invoke(null, manager, hurtInfoBase.hitInfo); return(hr); }
// Use this for initialization void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); bc2d = GetComponent <BoxCollider2D>(); hitReact = GetComponent <HitReaction>(); isDead = false; bullet = transform.Find("Sharp").gameObject; }
// Use this for initialization void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); bc2d = GetComponent <BoxCollider2D>(); anim = GetComponent <Animator>(); hitReact = GetComponent <HitReaction>(); controller = GetComponent <MonsterController>(); isDead = false; }
// Use this for initialization void Start() { muzzle = transform.Find("Muzzle").gameObject; spriteRenderer = GetComponent <SpriteRenderer>(); bc2d = GetComponent <BoxCollider2D>(); timer = cooldown; hitReact = GetComponent <HitReaction>(); isDead = false; StartCoroutine(Trigger()); }
// Start is called before the first frame update void Start() { GetComponent <Animator>().speed = animationSpeed; SpriteRenderer spriteRenderer = GetComponent <SpriteRenderer>(); hitReaction = GetComponent <HitReaction>(); //React to hit at start hitReaction.StartHitReaction(); //Rotate DeathObjects to lookDirection in moment of death if (lookDirection.x < 0) { spriteRenderer.flipX = true; } if (lookDirection.x > 0) { spriteRenderer.flipX = false; } }
void Awake() { animator = GetComponent <Animator>(); hitReaction = GetComponent <HitReaction>(); rigidbody = GetComponent <Rigidbody>(); if (targetPlayer == null) { targetPlayer = GameObject.FindGameObjectWithTag("Player"); } if (wayPoints.Length == 0) { wayPoints = GameObject.FindGameObjectsWithTag("WayPoint"); } if (blackBoard == null) { blackBoard = gameObject.GetComponent <Blackboard>(); } if (behaviourTree == null) { behaviourTree = gameObject.GetComponent <BehaviourTreeOwner>(); } if (blackBoard != null) { blackBoard.SetValue("target", targetPlayer); } if (behaviourTree != null) { List <GameObject> wps = new List <GameObject>(wayPoints); blackBoard.SetValue("PatrolWayPoints", wps); } currentHP = HP; ragdollUtility = GetComponent <RagdollUtility>(); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 point = new Vector3(_camera.pixelWidth / 2, _camera.pixelHeight / 2, 0); Ray ray = _camera.ScreenPointToRay(point); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { GameObject hitObject = hit.transform.gameObject; HitReaction enemyReaction = hitObject.GetComponent <HitReaction>(); if (enemyReaction != null) { enemyReaction.ReactToHit(); } else { StartCoroutine(PlaceSphereIndicator(hit.point)); } } } }
void Awake() { animator = GetComponent<Animator>(); hitReaction = GetComponent<HitReaction>(); rigidbody = GetComponent<Rigidbody>(); if (targetPlayer == null) { targetPlayer = GameObject.FindGameObjectWithTag("Player"); } if (wayPoints.Length == 0) { wayPoints = GameObject.FindGameObjectsWithTag("WayPoint"); } if(blackBoard == null) blackBoard = gameObject.GetComponent<Blackboard>(); if (behaviourTree == null) behaviourTree = gameObject.GetComponent<BehaviourTreeOwner>(); if (blackBoard != null) blackBoard.SetValue("target", targetPlayer); if (behaviourTree != null) { List<GameObject> wps = new List<GameObject>(wayPoints); blackBoard.SetValue("PatrolWayPoints", wps); } currentHP = HP; ragdollUtility = GetComponent<RagdollUtility>(); }
//Collider[] colliders; //EnemyGrab enemyGrab; /// <summary> /// Put this in Start() to init vars /// </summary> public void Initialize() { animator = this.GetComponent <Animator> (); agent = this.GetComponentInChildren <NavMeshAgent> (); stateController = this.GetComponentInChildren <StateController> (); obs = this.GetComponentInChildren <NavMeshObstacle> (); //enemyGrab = this.GetComponent<EnemyGrab> (); hitReaction = this.GetComponentInChildren <HitReaction>(); bodyIK = this.GetComponent <FullBodyBipedIK> (); initialSpeed = agent.speed; animator.enabled = true; stateController.enabled = true; agent.enabled = true; bodyIK.enabled = true; stateController.Default(); obs.enabled = false; hitPoints = 250; Rigidbody[] rbs = this.GetComponentsInChildren <Rigidbody> (); foreach (Rigidbody rb in rbs) { rb.useGravity = false; rb.isKinematic = false; rb.constraints = RigidbodyConstraints.FreezeRotation; if (rb.name == "DinolonglegLLegAnkle" || rb.name == "DinolonglegLLegPlatform" || rb.name == "DinolonglegRLegAnkle" || rb.name == "DinolonglegRLegPlatform" || rb.name == "Elbow_L" || rb.name == "DinolonglegRLegPlatform" || rb.name == "Elbow_R" || rb.name == "UpperArm" || rb.name == "ForeArm" || rb.name == "Hand") { rb.isKinematic = true; } } //colliders = this.GetComponentsInChildren<Collider> (); //OnOffCollider (true,true); }
private void Awake() { deathHandler = GetComponent <DeathHandler>(); hitReactionObject = GetComponentInChildren <HitReaction>(); }
public override HitReaction Hurt(HurtInfoBase hurtInfoBase) { EntityPhysicsManager physicsManager = (EntityPhysicsManager)Controller.PhysicsManager; HurtInfo3D hurtInfo = (HurtInfo3D)hurtInfoBase; HitReaction hitReaction = new HitReaction(); hitReaction.reactionType = HitReactionType.Hit; // Check if should hit grounded/aerial opponent. if (hurtInfo.hitInfo.groundOnly && !Controller.IsGrounded || hurtInfo.hitInfo.airOnly && Controller.IsGrounded) { hitReaction.reactionType = HitReactionType.Avoided; return(hitReaction); } HitInfo hitInfo = (HitInfo)hurtInfo.hitInfo; // Got hit. LastHitBy = hurtInfo.hitInfo; SetHitStop(hurtInfo.hitInfo.hitstop); SetHitStun(hurtInfo.hitInfo.hitstun); ((EntityManager)manager).healthManager.Hurt(hitInfo.damageOnHit); // Convert forces the attacker-based forward direction. switch (hitInfo.forceType) { case HitboxForceType.SET: Vector3 baseForce = hitInfo.opponentForceDir * hitInfo.opponentForceMagnitude; Vector3 forces = (hurtInfo.forward * baseForce.z + hurtInfo.right * baseForce.x); forces.y = baseForce.y; physicsManager.forceGravity.y = baseForce.y; forces.y = 0; physicsManager.forceMovement = forces; break; case HitboxForceType.PULL: Vector3 dir = transform.position - hurtInfo.center; if (!hitInfo.forceIncludeYForce) { dir.y = 0; } Vector3 forceDir = Vector3.ClampMagnitude((dir) * hitInfo.opponentForceMagnitude, hitInfo.opponentMaxMagnitude); float yForce = forceDir.y; forceDir.y = 0; if (hitInfo.forceIncludeYForce) { physicsManager.forceGravity.y = yForce; } physicsManager.forceMovement = forceDir; break; } if (physicsManager.forceGravity.y > 0) { Controller.IsGrounded = false; } // Change state to the correct one. if (Controller.IsGrounded && hitInfo.groundBounces) { Controller.StateManager.ChangeState((int)EntityStates.GROUND_BOUNCE); } else if (hitInfo.causesTumble) { Controller.StateManager.ChangeState((int)EntityStates.TUMBLE); } else { Controller.StateManager.ChangeState((int)(Controller.IsGrounded ? EntityStates.FLINCH : EntityStates.FLINCH_AIR)); } return(hitReaction); }
private void Awake() { spriteRenderer = GetComponent <SpriteRenderer>(); hitReact = GetComponent <HitReaction>(); controller = GetComponent <PlayerController>(); }