예제 #1
0
 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);
     }
 }
예제 #2
0
 public void ReassignHead(GigaSegmentedBehaviour gigaSegmentedBehaviour)
 {
     bodyPartBehaviour.bossBehaviour = gigaSegmentedBehaviour;
     //
     if (posteriorSegmentBehaviour != null)
     {
         posteriorSegmentBehaviour.ReassignHead(gigaSegmentedBehaviour);
     }
 }
예제 #3
0
 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;
     }
 }
예제 #4
0
    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>();
        }
    }