public override void LoseWeakPoint(string tag = "") { Debug.Log("Destuction tag: " + tag); // if (tag.Equals("Connection")) { posteriorSegmentBehaviour.LoseConnectionWithPrev(); posteriorSegmentBehaviour = null; posteriorSegment = null; // CheckDeath(); // TODO: Manejar aqui reaisgnacion en body part HeadBehaviour.StartSprint(); // enemyManager.ActivateEnemies(2, transform.position); } else if (tag.Equals("Generator")) { // De momento trabajamos con este valor currentLiftForce -= 25; // CheckDeath(); // StartSprint(); // enemyManager.ActivateEnemies(1, transform.position); } }
public void ReassignHead(GigaSegmentedBehaviour gigaSegmentedBehaviour) { bodyPartBehaviour.bossBehaviour = gigaSegmentedBehaviour; // if (posteriorSegmentBehaviour != null) { posteriorSegmentBehaviour.ReassignHead(gigaSegmentedBehaviour); } }
public void LoseConnectionWithPrev() { // Destroy(bodyPartBehaviour); previousSegment = null; previousSegmentBehaviour = null; // GetHeadMaterial(); // And tell your previous ones to reasign head reference if (posteriorSegmentBehaviour) { posteriorSegmentBehaviour.ReassignHead(this); //posteriorSegmentBehaviour = null; //posteriorSegment = null; } }
private void GetPreviousAndPosteriorSegements() { int index = transform.GetSiblingIndex(); // Debug.Log("Sibling index: " + index); // Chequeo de parte previa if (index == 0) { // En este caso es la cabeza activa GetHeadMaterial(); } else { previousSegment = transform.parent.GetChild(index - 1).gameObject; // previousSegmentBehaviour = previousSegment.GetComponent <GigaSegmentedBehaviour>(); // TODO: Revisar esta parte bodyPartBehaviour = gameObject.AddComponent <BodyPart>(); bodyPartBehaviour.previousBodyPart = previousSegment.transform; bodyPartBehaviour.bossBehaviour = HeadBehaviour; } // Chequeo de parte posterior if (index == transform.parent.childCount - 1) { // En este caso es la cola, desactivamos el weakpoint de conexion transform.GetChild(2).gameObject.SetActive(false); } else { posteriorSegment = transform.parent.GetChild(index + 1).gameObject; // posteriorSegmentBehaviour = posteriorSegment.GetComponent <GigaSegmentedBehaviour>(); } }