Inheritance: MonoBehaviour
示例#1
0
    private void Start()
    {
        lightDetector     = GetComponentInParent <LightDetector>();
        windowAudioSource = GetComponent <AudioSource>();

        targetColors = new List <string> {
            "Red", "Blue", "Green", "White", "Cyan", "Magenta", "Yellow"
        };
        //TODO: Remove this after testing
        //targetColors = new List<string> {"White"};
        //allColorsObtained = true;

        colorOrbs = new List <GameObject>();
        colorOrbs.Add(transform.Find("Red").gameObject);
        colorOrbs.Add(transform.Find("Blue").gameObject);
        colorOrbs.Add(transform.Find("Green").gameObject);
        colorOrbs.Add(transform.Find("White").gameObject);
        colorOrbs.Add(transform.Find("Cyan").gameObject);
        colorOrbs.Add(transform.Find("Magenta").gameObject);
        colorOrbs.Add(transform.Find("Yellow").gameObject);

        lightDetector.ColorAchievedEvent      += ColorAchieved;
        lightDetector.StartAnimationEvent     += AnimationStart;
        lightDetector.InterruptAnimationEvent += AnimationInterrupt;
        lightDetector.FinishAnimationEvent    += AnimationEnd;

        //When the level starts, the camera pauses on the window for a while and then travels to the player
        StartCoroutine(CameraPause());
    }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     lightDetector  = gameObject.GetComponent <LightDetector>();
     animator       = gameObject.GetComponent <Animator>();
     oriScale       = transform.localScale;
     gameObject.tag = "Spawner";
     spawned        = false;
 }
    // Use this for initialization
    void Start()
    {
        lightDetector = FindObjectOfType <LightDetector>();
        levelScript   = GetComponent <LevelScript>();

        obtainedColors = new List <string>();

        if (nextLevelCanvas != null)
        {
            nextLevelCanvas.SetActive(false);
        }
    }
示例#4
0
    // Use this for initialization
    void OnValidate () {
        // make sure the brightness and distance weight's = 100
        brightnessWeight = 1f - distanceWeight;

        // get necessary components
        connectedDetector = GetComponent<LightDetector>();
        enemyAI = GetComponent<AIPath2D>();
        enemy = GetComponent<Enemy>();
        colorSprite = GetComponentInChildren<SpriteRenderer>();

        // connect the starting speed to the connected enemy's speed
        startSpeed = enemyAI.speed;       
	}
示例#5
0
    void Start()
    {
        // Get Component
        agent                 = GetComponent <NavMeshAgent>();
        agent.enabled         = false;
        lightDetector         = GetComponent <LightDetector>();
        lightDetector.enabled = false;
        animator              = GetComponent <Animator>();
        rigidbody             = GetComponent <Rigidbody>();
        lastPos               = transform.position;
        rigidbody.constraints = RigidbodyConstraints.FreezeAll;

        // stop movings
        grow       = -growSpeed;
        reachlevel = false;
    }
示例#6
0
文件: Insanity.cs 项目: JonECG/Spoopy
 // Use this for initialization
 void Start()
 {
     lightDetect = FindObjectOfType<LightDetector>();
 }