Esempio n. 1
0
    private void L2PuzzleInteraction()
    {
        Color        dogColor = monster.GetComponent <SpriteRenderer>().color;
        Level2Script L2       = currentWorld.GetComponent <Level2Script>();

        float slamSpeed = player.GetComponent <Rigidbody2D>().velocity.magnitude;

        if (monster.HitOnHead(playerCol, slamSpeed) && player.Interact)
        {
            player.Force = 0;
            if (dogColor == Color.white) // Check to see if dog is already holding paper
            {
                dogColor = L2.PickupPaper(monCol, dogColor);
                if (dogColor != Color.white)
                {
                    monster.GrabNewspaper();
                }
            }
            else
            {
                Color returnedMailColor = L2.DropPaper(monCol, dogColor);
                if (returnedMailColor != Color.white)
                {
                    L2.TurnOnLight(returnedMailColor);
                }
                dogColor = Color.white;
                monster.DropNewspaper(); // Change to dog without paper
            }
            monster.GetComponent <SpriteRenderer>().color = dogColor;
        }
        if (monster.GetComponent <Animator>().GetBool("WithPaperB"))
        {
            L2.UpdatePickedUpPaper(monCol, dogColor);
        }
    }
Esempio n. 2
0
    void Start()
    {
        //Check if instance already exists
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this);
        }

        level       = 2;
        MonsterView = new Vector3(0, 10f, -130); // Change parent variables to the level settings.
        WorldView   = new Vector3(0, 0, -590);
        Rotation    = new Vector3(0, 0, 8);
        this.transform.eulerAngles = new Vector3(0, 0, 220);

        // ---------------- Create the Mail ---------------- //
        newspapers    = new GameObject[mailBoxes.Length];
        mailDelivered = new bool[mailBoxes.Length];

        winColor.Add(Color.red, "Red");
        winColor.Add(Color.green, "Green");
        winColor.Add(Color.blue, "Blue");
        winColor.Add(Color.yellow, "Yellow");
        winColor.Add(new Color(0.5f, 0f, 0.5f, 1f), "Purple");
        winColor.Add(new Color(1, .64f, 0f, 1f), "Orange");
        List <Color> mailColour = new List <Color>();

        foreach (KeyValuePair <Color, string> w in winColor)
        {
            mailColour.Add(w.Key);
        }
        List <Color> paperColour = new List <Color>(mailColour);  // Duplicate as other list gets deleted

        mailBoxWorldEdge   = this.transform.localScale.x * -9f;   // fixed amount of where the world edge is
        newspaperWorldEdge = this.transform.localScale.x * -7.8f; // fixed amount of where the world edge is
        float start     = 0.42f;                                  // Left side of house
        float increment = .9f / mailBoxes.Length;                 // 90% of world is open

        for (int i = 0; i < mailBoxes.Length; i++)
        {
            mailBoxes[i]  = MailMaker(mailBoxPrefab, mailColour, start, increment, mailBoxWorldEdge);
            newspapers[i] = MailMaker(newspaperPrefab, paperColour, start, increment, newspaperWorldEdge);

            start           += increment;
            mailDelivered[i] = false;
        }
    }
Esempio n. 3
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        levelState = "null";

        waitTime           = 0.0f;
        stopSpawns         = false;
        pauseWait          = false;
        stopOperationsDone = false;
    }
    // Use this for initialization
    void Start()
    {
        //Private GameObjects
        player = GameObject.FindWithTag("Player");

        //boatAIScriptOne = boatSpawnOne.GetComponent<Boat_AI>();
        //boatAIScriptTwo = boatSpawnTwo.GetComponent<Boat_AI>();
        level1Script  = player.GetComponent <Level1Script>();
        level2Script  = player.GetComponent <Level2Script>();
        level3Script  = player.GetComponent <Level3Script>();
        level4Script  = player.GetComponent <Level4Script>();
        level5Script  = player.GetComponent <Level5Script>();
        level6Script  = player.GetComponent <Level6Script>();
        level7Script  = player.GetComponent <Level7Script>();
        level8Script  = player.GetComponent <Level8Script>();
        level9Script  = player.GetComponent <Level9Script>();
        level10Script = player.GetComponent <Level10Script>();

        Screen.showCursor = false;                      //Disable Mouse Cursor

        healthBarLength = Screen.width / 3;

        //particleFog.enableEmission = false;
        //deathFog.SetActive (false);
        //deathFog.enableEmission = false;

        //Coroutines
        //StartCoroutine (BuoyLight());

        //Functions
        LighthouseMovement();
        LightHouseInput();
        HealthandPoints();

        StartCoroutine(LevelTitle());
    }