private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Valkyrie") { ValkyrieController otherValkyrieController = other.GetComponent <ValkyrieController>(); if (otherValkyrieController.isCarrying == true) { // Make other valkyrie drop pickup if carrying and hit other.GetComponent <ValkyrieController>().DropPickup(); //should change if we do a shield mechanic // Add to the score of the valkyrie when you successfully attack another valkyrie if (m_scoreManager != null) { m_scoreManager.AddToScore(ScorePointInfo.hitOpponent, m_playerData.m_PlayerIndex); Debug.Log("I hit a valkyrie and got " + ScorePointInfo.hitOpponent + "points!"); } else { Debug.Log("Score manager is null"); } } otherValkyrieController.GetStunned(); } }
// Use this for initialization void OnStart() { m_valkyrie = GetComponentInParent <ValkyrieController>(); m_gameController = GameController.Instance; m_scoreManager = m_gameController.m_scoreManager; m_playerData = GetComponentInParent <PlayerData>(); }
void OnTriggerStay(Collider other) { Debug.Log("Viking is colliding with" + other.gameObject.tag); m_collisionTag = other.gameObject.tag; // pickup if it has tag "Valkyrie" and we are not carrying anything if (m_collisionTag == "Valkyrie" && m_immuneToPickUp == false) { m_valkyrie = other.gameObject.GetComponent <ValkyrieController>(); if (m_valkyrie.isCarrying == false) { GetPickedUp(other); } } }
void GrabbyHandCheck() { Collider[] objectsInRange = Physics.OverlapSphere(transform.position, maxDistanceForGrabbyHands); foreach (Collider other in objectsInRange) { if (other.gameObject.tag == "Valkyrie") { ValkyrieController valkyrie = other.gameObject.GetComponent <ValkyrieController>(); if (valkyrie != null) { int valkyrieIndex = valkyrie.transform.parent.GetComponent <PlayerData>().m_PlayerIndex; int vikingIndex = transform.parent.GetComponent <PlayerData>().m_PlayerIndex; // linear falloff of effect float proximity = (transform.position - valkyrie.transform.position).magnitude; float rumblePercent = ExtensionMethods.Remap(proximity, maxDistanceForGrabbyHands, 1.5f, 0, 0.8f); if (proximity >= maxDistanceForGrabbyHands) { m_rumbleManager.GrabbyHandsVibrate(0, valkyrieIndex); m_rumbleManager.GrabbyHandsVibrate(0, vikingIndex); valkyrie.isCloseToViking = false; valkyrie.isIdle = true; } else if (valkyrie.isCarrying || m_isPickedUp) { valkyrie.isCloseToViking = false; valkyrie.isCarrying = true; m_rumbleManager.GrabbyHandsVibrate(0, valkyrieIndex); m_rumbleManager.GrabbyHandsVibrate(0, vikingIndex); } else if (!valkyrie.isCarrying && !m_isPickedUp) { m_rumbleManager.GrabbyHandsVibrate(rumblePercent, valkyrieIndex); m_rumbleManager.GrabbyHandsVibrate(rumblePercent, vikingIndex); valkyrie.isCloseToViking = true; } } } } }