Exemple #1
0
// ###############################################################
// Unity Functions
// ###############################################################
    void Start()
    {
        // OtterGenerator has a dictionary of scared zones to otters
        thisOtter = OtterGenerator.scaredZoneToOtterController[gameObject];
        // Connect to the SpriteRenderer so we can set the alpha = 0 on higher diffs
        scaredZone = gameObject.GetComponent <SpriteRenderer>();
        setAlphaToDiff();
    }
// ###############################################################
// Unity Functions
// ###############################################################
    void Start()
    {
        // set how fast the camera darkens
        deltaAlpha = Time.deltaTime / 2f;         // Set amount the camera icon alpha will increase for each frame
        // Connect to UI elements to destroy
        leftEdge           = transform.Find("Left Edge").gameObject;
        rightEdge          = transform.Find("Right Edge").gameObject;
        cameraIcon         = transform.Find("Camera Icon").gameObject;
        cameraIconRenderer = cameraIcon.GetComponent <SpriteRenderer>();
        picRegion          = gameObject.GetComponent <SpriteRenderer>();
        // Connect to canvas for "Flash"
        canvasImage = GameObject.Find("Canvas").GetComponent <Image>();
        // If Tutorial or Easy make pic region green
        if (GameController.missionDiff == "Tutorial" || GameController.missionDiff == "Easy")
        {
            picRegion.color = new Vector4(1f, 1f, 1f, 75f / 255f);
        }
        // connect to our otter
        thisOtter = OtterGenerator.picRegionToOtterController[gameObject];
    }