Ejemplo n.º 1
0
    //Dealing with the player stat dictionary
    public int getStat(string resourceName)
    {
        if (!ShipResources.ContainsKey(resourceName))
        {
            ShipResources.Add(resourceName, 0);
        }

        //returns the value of the given stat
        return(ShipResources[resourceName]);
    }
Ejemplo n.º 2
0
 public void setStat(string resourceName, int Value)
 {
     if (ShipResources.ContainsKey(resourceName))
     {
         ShipResources[resourceName] = Value;
     }
     else
     {
         //If the stat doesnt exist and we are setting it, lets just create it
         ShipResources.Add(resourceName, Value);
     }
     //
 }
Ejemplo n.º 3
0
 public void changeStat(string resourceName, int statChange)
 {
     if (ShipResources.ContainsKey(resourceName))
     {
         ShipResources[resourceName] = getStat(resourceName) + statChange;
         if (ShipResources[resourceName] < 0)
         {
             ShipResources[resourceName] = 0;
         }
     }
     else
     {
         //If the stat doesnt exist and we are setting it, lets just create it
         ShipResources.Add(resourceName, statChange);
     }
     //
 }
Ejemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        shipResources       = GetComponent <ShipResources>();
        mainCamera          = GameObject.Find("Main Camera").GetComponent <Camera>();
        joystick            = GameObject.Find("Fixed Joystick").GetComponent <FixedJoystick>();
        r                   = GetComponent <Rigidbody>();
        r.useGravity        = false;
        lookRotation        = transform.rotation;
        defaultShipRotation = spaceshipRoot.localEulerAngles;
        rotationZ           = defaultShipRotation.z;

        mainCamera.transform.position = cameraPosition.position;
        mainCamera.transform.rotation = cameraPosition.rotation;

        if (useMouse)
        {
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
        }
    }
Ejemplo n.º 5
0
 void Awake()
 {
     instance = this;
 }