Ejemplo n.º 1
0
 //Function to hold surface changing code
 private void EquipSurface()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         equippedMaterial = GameController.material.BOUNCE;
     }
     if (Input.GetKeyDown(KeyCode.Alpha2))
     {
         equippedMaterial = GameController.material.SLIP;
     }
     if (Input.GetKeyDown(KeyCode.Alpha3))
     {
         equippedMaterial = GameController.material.STICK;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Right click reverts material to original color, left click assigns it the player's equipped color
 /// </summary>
 void OnMouseOver()
 {
     if (changeable)
     {
         // Left click
         if (Input.GetMouseButton(0))
         {
             ChangeMaterial();
         }
         // Right click
         else if (Input.GetMouseButton(1))
         {
             GetComponent <Renderer>().material = ChosenSurface[3];
             type = GameController.material.NONE;
             InitializeSurfaceSpeeds(GameController.material.NONE);
             SetTiling();
         }
     }
 }
Ejemplo n.º 3
0
    /// <summary>
    /// Changes the appearance of the material (currently just changes color)
    /// </summary>
    void ChangeMaterial()
    {
        switch (player.equippedMaterial)
        {
        case GameController.material.BOUNCE:
            GetComponent <Renderer>().material = ChosenSurface[0];
            SetSurfaceTiling();
            break;

        case GameController.material.SLIP:
            GetComponent <Renderer>().material = ChosenSurface[1];
            SetTiling();
            break;

        case GameController.material.STICK:
            GetComponent <Renderer>().material = ChosenSurface[2];
            SetSurfaceTiling();
            break;
        }
        type = player.equippedMaterial;

        InitializeSurfaceSpeeds(player.equippedMaterial);
    }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes surface with associated move speeds from surfaceSpeeds (called from derived class)
 /// </summary>
 protected void InitializeSurfaceSpeeds(GameController.material materialType)
 {
     // Initialize surface speeds
     surfaceSpeeds = GameObject.FindWithTag("GameController").GetComponent <GameController>().speedMapping[materialType];
 }