private void Start() { moveHandler = GetComponent <MoveHandler>(); flagHandler = GetComponent <FlagHandler>(); animator = GetComponent <Animator>(); stunGauge = baseStunGauge; entityController = GetComponent <EntityControllerComp>(); hasEntityController = (entityController != null); }
//private bool inDeathAnimation; // Start is called before the first frame update void Start() { healthComponent = GetComponent <HealthComponent>(); entityController = GetComponent <EntityControllerComp>(); flagHandler = GetComponent <FlagHandler>(); anim = GetComponent <Animator>(); isDead = false; //inDeathAnimation = false; healthComponent.OnDeath += AtZeroHP; }
protected virtual void Start() { moveHandler = GetComponent <MoveHandler>(); targeter = GetComponent <Targeter>(); entityController = GetComponent <EntityControllerComp>(); hasEntityController = (entityController != null); flagHandler = GetComponent <FlagHandler>(); avoider = GetComponentInChildren <Avoider>(); hasAvoider = (avoider != null); linksToAttempt = new List <MoveLink>(); }
void Movement(Vector2 move) { /* im copying this over from the prototype, a lot of it is based on a * tutorial for a platformer so I will mostlikely need to change parts of * it later*/ float distance = move.magnitude; //int count = rb2d.Cast(move, contactFilter, hitBuffer, distance + 0.01f); int count = entityCollider.Cast(move, contactFilter, hitBuffer, distance + 0.01f); hitBufferList.Clear(); for (int i = 0; i < count; i++) { bool add = true; //TODO: another way of checking that does not involve tags if (hitBuffer[i].collider.tag == "Entity" || hitBuffer[i].collider.tag == "Player") { if (!allowEntityCollision || (hitBuffer[i].collider.GetComponent <EntityControllerComp>() != null && !hitBuffer[i].collider.GetComponent <EntityControllerComp>().AllowEntityCollision)) { add = false; } } if (add) { hitBufferList.Add(hitBuffer[i]); } } for (int i = 0; i < hitBufferList.Count; i++) { Vector2 currentNormal = hitBufferList[i].normal; if (currentNormal.y > 0.65f) { EntityControllerComp ec = hitBufferList[i].transform.gameObject.GetComponent <EntityControllerComp>(); if (ec == null) { grounded = true; } } float projection = Vector2.Dot(velocity, currentNormal); if (projection < 0) { velocity -= projection * currentNormal; //corrections.x = velocity.x; corrections.x = -(projection * currentNormal.x); } float modifiedDistance = hitBufferList[i].distance - 0.01f; distance = modifiedDistance < distance ? modifiedDistance : distance; } rb2d.position = rb2d.position + move.normalized * distance; }
// Use this for initialization /*void Start () { * moveHandler.GenericStateEvent += EnterGenericState; * }*/ private void Awake() { directionalInput = Vector2.zero; inputBuffers = new InputBuffer[inputNames.Length]; for (int i = 0; i < inputBuffers.Length; i++) { inputBuffers[i] = new InputBuffer(inputNames[i]); } HookInputActions(); flagHandler = GetComponent <FlagHandler>(); moveHandler = GetComponent <MoveHandler>(); entityController = GetComponent <EntityControllerComp>(); healthComp = GetComponent <HealthComponent>(); CurrentMoves = new List <MoveLink>(); GenerateMoveList(); entityController.LandingEvent += OnLandingEvent; GameManager.Instance.PlayerHealth = healthComp; }
// Use this for initialization void Awake() { currentMove = null; animator = GetComponent <Animator>(); flagHandler = GetComponent <FlagHandler>(); entityController = GetComponent <EntityControllerComp>(); playerInput = GetComponent <PlayerInputHandler>(); targeter = GetComponent <Targeter>(); healthComp = GetComponent <HealthComponent>(); if (healthComp != null) { healthComp.OnDeath += Die; } flagHandler.Flags = new FlagData(defaultFlagValues, ValueFlags.None); moveTime = 0; dodgeCount = 0; overDodge = 0; listenToMoveMotion = true; lastMoveTime = 0; }
// Use this for initialization void Start() { xdistance = float.MaxValue; entityController = GetComponent <EntityControllerComp>(); flagHandler = GetComponent <FlagHandler>(); }