示例#1
0
    }//new spot in list

    void OnTriggerExit(Collider other)
    {
        if (other.tag == "Spot")
        {
            Transform otherRenderer = other.GetComponent <Transform>();
            spotsDetected.Remove(otherRenderer);
        }
        else if (other.tag == "Skeleton")
        {
            skDialogueManager oldSkeleton = other.GetComponent <skDialogueManager>();
            skDetected.Remove(oldSkeleton);
        }
    }//spot out of list
示例#2
0
    IEnumerator Cinematic()
    {
        PlayerController.controlsAble = false;
        boxDialogueAnim.SetBool("opened", true);
        pD.Play(timelines [timelineID]);
        timelineID++;
        while (pD.state == PlayState.Playing)
        {
            yield return(null);
        }
        PlayerController.controlsAble = true;
        boxDialogueAnim.SetBool("opened", false);
        UIDialogueText.ClearDisplay();
        GameObject captain = GameObject.FindGameObjectWithTag("Captain");

        if (timelineID == 1)
        {
            //transform.GetComponentInChildren<skDialogueManager> ().enabled = true;
            barkTuto = true;
        }

        if (timelineID == 3)
        {
            captain.GetComponent <skCaptainBehaviour> ().MoveToRubble();
            SetElementsActive(true);
        }

        if (timelineID == 4)
        {
            captain.GetComponent <skCaptainBehaviour> ().enabled = false;

            skBehaviour skBh = captain.AddComponent <skBehaviour> ();
            skBh.SetMemento(new Memento(0, "Captain Tuto", 3, 0.9f));

            skDialogueManager dialogueMan = captain.AddComponent <skDialogueManager>();
            print(GameObject.FindGameObjectWithTag("SkSpawner").name);
            dialogueMan.mySkSpawner   = GameObject.Find("SkSpawner").GetComponent <skSpawner>();
            dialogueMan.mySkBehaviour = skBh;
            skBh.mySkDialogueManager  = dialogueMan;
            dialogueMan.SetMemento(new Memento(0, "Captain Tuto", 3, 0.9f));
            dialogueMan.SetUIDialogueText(UIDialogueText);

            captain.tag = "Skeleton";

            tutoEnded = true;

            Destroy(gameObject);
        }
    }
示例#3
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Spot")
     {
         Transform actualSpot = other.GetComponent <Transform>();
         spotsDetected.Add(actualSpot);
     }
     else if (other.tag == "Skeleton")
     {
         skDialogueManager newSkeleton = other.GetComponent <skDialogueManager>();
         skDetected.Add(newSkeleton);
     }
     else if (other.tag == "Cloche")
     {
         Animator newCloche = other.GetComponent <Animator>();
         clochesDetected.Add(newCloche);
     }
 }//new spot in list
示例#4
0
    /// <summary>
    /// This thing does things.
    /// </summary>
    public void Bark()
    {
        RaycastHit hit;
        int        layerMask = LayerMask.GetMask("Interactable");

        if (Physics.Raycast(transform.position, transform.forward, out hit, 9, layerMask))
        {
            if (hit.collider.CompareTag("FlowerEmitter"))
            {
                Vector3    spawnPosition = transform.position + new Vector3(0, -0.8f, 0);
                GameObject barkPart      = Instantiate(barkPartPrefab, spawnPosition, Quaternion.identity);
                StartCoroutine(hit.collider.GetComponent <AmplifiedBark> ().BarkSound());
                Destroy(barkPart, 4);
                flowerEmitterTransform = hit.collider.GetComponent <Transform>();
                FlowerEmitterAction();
            }

            //assembly
            if (hit.collider.CompareTag("SkSpawner"))
            {
                skSelector selector = hit.collider.GetComponent <skSelector>();
                selector.StartCoroutine("BeginAssembly");
            }
        }
        else
        {
            //Detecting spots------------------------------------------------------------------------------------------
            Vector3    spawnPosition = transform.position + new Vector3(0, -0.8f, 0);
            GameObject barkPart      = Instantiate(barkPartPrefab, spawnPosition, Quaternion.identity);
            Destroy(barkPart, 4);

            for (int i = 0; i < spotsDetected.Count; i++)
            {
                if (spotsDetected [i] != null)
                {
                    if (Vector3.Distance(spotsDetected [i].transform.position, playerController.transform.position) < showRange)
                    {
                        GameObject flowerPart = Instantiate(littleFlowerPartPrefab, spotsDetected[i].position, Quaternion.identity);
                        spotsDetected [i].GetComponent <SpotManager> ().SFX();
                        Destroy(flowerPart, 4);
                    }
                }
                else
                {
                    spotsDetected.RemoveAt(i);
                }
            }

            //Engage conversation with skeletons--------------------------------------------------------------------
            float             distanceToSkeleton = 20;
            skDialogueManager nearestSk          = null;
            for (int i = 0; i < skDetected.Count; i++)
            {
                float newDistance = Vector3.Distance(transform.position, skDetected[i].transform.position);
                if (newDistance < distanceToSkeleton)
                {
                    distanceToSkeleton = newDistance;
                    nearestSk          = skDetected[i];
                }
            }
            if (nearestSk != null && nearestSk.dialogueState != "Dialogue")
            {
                if (Random.Range(0, 2) == 0)
                {
                    nearestSk.dialogueType = "Casual";
                }
                else
                {
                    nearestSk.dialogueType = "Hint";
                }
                nearestSk.dialogueState = "InstantDialogue";
                nearestSk.StartDialogue();
            }
        }
        //Ringing Bells---------------
        for (int i = 0; i < clochesDetected.Count; i++)
        {
            if (clochesDetected[i] != null)
            {
                clochesDetected[i].SetTrigger("Ringing");
            }
        }
    }
示例#5
0
	public void SpawnFromParts (GameObject headObj, GameObject torsoObj, GameObject legObj, Memento memento) 
	{
		
		//Add the adder script to torso
		skPartAdder skPA = torsoObj.AddComponent<skPartAdder> ();
		//Add head and leg to torso
		skPA.AddLimb (headObj, torsoObj);
		skPA.AddLimb (legObj, torsoObj);
		//Physics yeah !
		CapsuleCollider capCo = torsoObj.AddComponent<CapsuleCollider> ();
		capCo.height = 2f;
		capCo.center = new Vector3 (0f, 1f, 0f);
		Rigidbody rB = torsoObj.AddComponent<Rigidbody> ();
		rB.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
		rB.isKinematic = true;
		//Behaviour
		torsoObj.AddComponent<NavMeshAgent>();
		torsoObj.AddComponent<AudioSource> ();

		if (memento.ID == 0) 
		{
			skCaptainBehaviour skCBh  = torsoObj.AddComponent<skCaptainBehaviour> ();
			skCBh.SetMemento (memento);
			torsoObj.GetComponentInChildren<Animator> ().enabled = true;

			torsoObj.tag = "Captain";

		}
		else 
		{
			skBehaviour skBh = torsoObj.AddComponent<skBehaviour> ();
			skBh.SetMemento (memento);

			torsoObj.GetComponentInChildren<Animator> ().enabled = true;

			skDialogueManager dialogueMan = torsoObj.AddComponent<skDialogueManager>();
			dialogueMan.mySkBehaviour = skBh;
			skBh.mySkDialogueManager = dialogueMan;
            dialogueMan.mySkSpawner = GetComponent<skSpawner>();
            dialogueMan.SetMemento (memento);
            switch (memento.name)
            {
                case "Pedro":
                    skBh.mySpot = skSpotsBeforeRubble[0];
                    skSpawned[0] = true;
                    readyToRubbleSetter[0] = skBh;
                    break;
                case "Sancho":
                    skBh.mySpot = skSpotsBeforeRubble[1];
                    skSpawned[1] = true;
                    readyToRubbleSetter[1] = skBh;
                    break;
                case "Alessandro":
                    skBh.mySpot = skSpotsBeforeRubble[2];
                    skSpawned[2] = true;
                    readyToRubbleSetter[2] = skBh;
                    break;
            }
            dialogueMan.SetUIDialogueText (UIDialogueText);
			dialogueMan.dialogueType = "Spawn";
			dialogueMan.StartDialogue();

			torsoObj.tag = "Skeleton";


            if (skSpawned[0] && skSpawned[1] && skSpawned[2])
            {
                print("0");
                for (int i = 0; i < readyToRubbleSetter.Length; i++)
                {
                    readyToRubbleSetter[i].readyToRubble = true;
                    readyToRubbleSetter[i].MoveToRubble();
                }
            }
        }

	}