Inheritance: MonoBehaviour
Exemple #1
0
    public void RefreshVisibleCreatures()
    {
        if (currentCreatureBatch == null)
        {
            return;
        }

        var contractionVisibility = PlayerPrefs.GetInt(PlayerPrefsKeys.SHOW_MUSCLE_CONTRACTION, 0) == 1;

        foreach (var creature in currentCreatureBatch)
        {
            creature.RefreshMuscleContractionVisibility(contractionVisibility);
        }

        // Determine if all or only one creature should be visible
        if (settings.showOneAtATime)
        {
            foreach (var creature in currentCreatureBatch)
            {
                creature.SetOnInvisibleLayer();
            }

            CameraFollowScript cam = Camera.main.GetComponent <CameraFollowScript>();
            currentCreatureBatch[cam.currentlyWatchingIndex].SetOnVisibleLayer();
        }
        else
        {
            foreach (var creature in currentCreatureBatch)
            {
                creature.SetOnVisibleLayer();
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        if (moveSpeed == 0)
        {
            moveSpeed = 3;
        }
        if (sensitivity == 0)
        {
            sensitivity = 5;
        }
        if (jumpPower == 0)
        {
            jumpPower = 5;
        }

        cam  = Camera.main;
        CFS  = cam.GetComponent <CameraFollowScript> ();
        rb   = GetComponent <Rigidbody> ();
        anim = GetComponent <Animator> ();

        Health h = this.gameObject.AddComponent <Health> ();

        //h.SetHealth (maxHealth);
        //h.maxHealth = maxHealth;

        this.GetComponent <PlayerUIManager> ().SetHealthUI(maxHealth, maxHealth);
        this.GetComponent <PlayerUIManager> ().SetComboUI(0, maxCombo);

        //Deal with mouse
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;
    }
Exemple #3
0
 // Start is called before the first frame update
 void Start()
 {
     CurrentElements = new Dictionary <string, GameObject>();
     CM            = GameController.Game.ContentManager;
     Canvas        = GetComponentInChildren <Canvas>();
     CameraScript  = GameController.Game.CameraFollowScript;
     LoadScreenObj = GameObject.Find("Loading");
 }
Exemple #4
0
 private void Awake()
 {
     if (CFS == null)
     {
         CFS = this;
     }
     else if (CFS != this)
     {
         Destroy(this);
     }
 }
Exemple #5
0
    public void FocusOnNextCreature()
    {
        CameraFollowScript cam = Camera.main.GetComponent <CameraFollowScript>();
        int index = (cam.currentlyWatchingIndex + 1) % currentCreatureBatch.Length;

        cam.currentlyWatchingIndex = index;
        //cam.toFollow = currentGeneration[index];
        cam.toFollow = currentCreatureBatch[index];

        RefreshVisibleCreatures();
    }
Exemple #6
0
 void Start()
 {
     camera = GameObject.FindGameObjectWithTag("camera").GetComponent <CameraFollowScript>();
     OSES   = camera.GetComponent <onScreenElementsScript>();
     //player = GameObject.FindGameObjectWithTag ("player");
     currentXP = 0; baseXPMax = 100;
     // SETTING TANKS DAMAGE ABILITIES
     setAbilityOneDamage();
     setabilityTwoDamage();
     setabilityThreeDamage();
 }
Exemple #7
0
    public void FocusOnPreviousCreature()
    {
        CameraFollowScript cam = Camera.main.GetComponent <CameraFollowScript>();
        int index = cam.currentlyWatchingIndex;

        //cam.currentlyWatchingIndex = index - 1 < 0 ? currentGeneration.Length - 1 : index - 1;
        cam.currentlyWatchingIndex = index - 1 < 0 ? currentCreatureBatch.Length - 1 : index - 1;
        //cam.toFollow = currentGeneration[index];
        cam.toFollow = currentCreatureBatch[cam.currentlyWatchingIndex];

        RefreshVisibleCreatures();
    }
    /// <summary>
    /// Sets the layer number for this parallax movement.
    /// </summary>
    public void SetLayer(int i)
    {
        gameObject.layer = LayerMask.NameToLayer("Background " + i.ToString());

        cam       = GameObject.Find(i.ToString() + " Camera").transform;
        camFollow = cam.GetComponent <CameraFollowScript>();
        camFollow.ParallaxFollowers.Add(this);

        lastCamPos = cam.transform.position;

        totalOffset = Vector2.zero;
    }
    void Start()
    {
        camera = GameObject.FindGameObjectWithTag("camera").GetComponent <CameraFollowScript>();
        OSES   = camera.GetComponent <onScreenElementsScript>();

        // SETTING DAMAGE OF ARCHERS ABILITIES
        // METHODS TAKEN FROM ARCHER-CHARACTER-SCRIPT
        setFireShotDamage();
        setPiercingDamage();
        setHOADamage();
        //player = GameObject.Find("player");
        currentXP = 0; baseXPMax = 100;
    }
    private void Awake()
    {
        if (followScriptInstance == null)
        {
            followScriptInstance = this;
        }
        else if (followScriptInstance != this)
        {
            Destroy(gameObject);
            followScriptInstance.player = FindObjectOfType <PlayerController>();
        }

        DontDestroyOnLoad(gameObject);
        player = FindObjectOfType <PlayerController>();
    }
    // Use this for initialization
    void Start()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        camera = Camera.main.transform;
        CameraFollowScript followScript = camera.GetComponent <CameraFollowScript>();

        followScript.Target = transform;
        followScript.Offset = cameraOffset;

        characterController = GetComponent <CharacterController>();
        animator            = GetComponent <Animator>();
    }
    public GameObject CreatePlayerCamera(GameObject playerFollowing, int totalCameras)
    {
        //Create.
        GameObject g       = (GameObject)Instantiate(PlayerCameraPrefab);
        Vector3    playPos = playerFollowing.transform.position;

        g.transform.position = new Vector3(playPos.x, playPos.y, g.transform.position.z);

        //Get components.
        IDData             dat = playerFollowing.GetComponent <IDData>();
        CameraFollowScript c   = g.GetComponent <CameraFollowScript>();

        //Set component data.
        g.name = dat.PlayerID + " Camera";
        c.SetTarget(playerFollowing.GetComponent <StateMachine>());

        //Set the view area.
        int i = dat.PlayerID - 1;

        switch (totalCameras)
        {
        case 1: break;

        case 2: c.camera.rect = new Rect(i * 0.5f, 0.0f, 0.5f, 1.0f);
            break;

        case 3: c.camera.rect = (i < 2 ? new Rect(i * 0.5f, 0.0f, 0.5f, 0.5f) :
                                 new Rect(0.25f, 0.5f, 0.5f, 0.5f));
            break;

        case 4: c.camera.rect = (i < 2 ? new Rect(i * 0.5f, 0.0f, 0.5f, 0.5f) :
                                 new Rect((i - 2) * 0.5f, 0.5f, 0.5f, 0.5f));
            break;

        default: throw new ArgumentOutOfRangeException("Must be one to four players!");
        }

        //Set the view size.
        c.camera.orthographicSize = Screen.height * c.camera.rect.height * 0.5f * scale / SpriteHeight;
        ShowCullLayer(c.camera, "Background " + dat.PlayerID);

        return(g);
    }
Exemple #13
0
    // Use this for initialization

    void Start()
    {
        clickPosition = new Vector2(0f, 0f);
        cameraScript  = Camera.main.GetComponent <CameraFollowScript>();
        anim          = GetComponent <Animator>();
        anim.enabled  = false;
        playerObj     = GameObject.FindGameObjectWithTag("Player");
        player        = playerObj.GetComponent <PlayerControl>();

        //if this door leads up
        if (exit.position.y > transform.position.y)
        {
            transform.GetComponent <SpriteRenderer>().sprite = up;
        }
        //if door leads down
        else if (exit.position.y < transform.position.y)
        {
            transform.GetComponent <SpriteRenderer>().sprite = down;
        }

        if (exit.gameObject.name.Equals("AtticDoor"))
        {
            boardedDoor = GameObject.FindGameObjectWithTag("BoardedDoor");
            boardedDoor.transform.position = this.transform.position;
        }



        /*
         *      //if this door leads up
         *      if (exitlock.position.y > transform.position.y)
         *      {
         *          transform.GetComponent<SpriteRenderer>().sprite = up;
         *      }
         *      //if door leads down
         *      else if (exitlock.position.y < transform.position.y)
         *      {
         *          transform.GetComponent<SpriteRenderer>().sprite = down;
         *      }
         */
    }
    // Use this for initialization
    void Start()
    {
        clickPosition = new Vector2(0f, 0f);
        cameraScript = Camera.main.GetComponent<CameraFollowScript>();
        anim = GetComponent<Animator>();
        anim.enabled = false;
        playerObj = GameObject.FindGameObjectWithTag("Player");
        player = playerObj.GetComponent<PlayerControl>();

        //if this door leads up
        if (exit.position.y > transform.position.y)
        {
            transform.GetComponent<SpriteRenderer>().sprite = up;
        }
        //if door leads down
        else if (exit.position.y < transform.position.y)
        {
            transform.GetComponent<SpriteRenderer>().sprite = down;
        }

        if (exit.gameObject.name.Equals("AtticDoor"))
        {
            boardedDoor = GameObject.FindGameObjectWithTag("BoardedDoor");
            boardedDoor.transform.position = this.transform.position;
        }

        /*
                //if this door leads up
                if (exitlock.position.y > transform.position.y)
                {
                    transform.GetComponent<SpriteRenderer>().sprite = up;
                }
                //if door leads down
                else if (exitlock.position.y < transform.position.y)
                {
                    transform.GetComponent<SpriteRenderer>().sprite = down;
                }
        */
    }
 // Use this for initialization
 void Start()
 {
     CFS = GameObject.Find("Main Camera").GetComponent <CameraFollowScript> ();
     SPS = GameObject.Find("SoundObject").GetComponent <SoundPlayerScript> ();
     Invoke("StartGame", 2f);
 }
Exemple #16
0
 private void Awake()
 {
     instance = this;
 }
 void Awake(){
   instance = this;
 }
 // Start is called before the first frame update
 void Start()
 {
     Player = GameController.Game.Player;
     Camera = GameController.Game.CameraFollowScript;
 }
Exemple #19
0
 // Use this for initialization
 void Awake()
 {
     clickPosition = new Vector2(0f, 0f);
     cameraScript = Camera.main.GetComponent<CameraFollowScript>();
 }
 // Start is called before the first frame update
 void Start()
 {
     mainCamera = GetComponent <Camera>();
     Camera     = this;
     SetScreenCollider();
 }
Exemple #21
0
 /// <summary>
 /// Gets the maximum speed of the given camera.
 /// Default: returns four times the distance between the camera and its target.
 /// </summary>
 public static float DefaultCamMaxSpeedFunction(CameraFollowScript c)
 {
     return(4.0f * Vector2.Distance(c.ThisTransform.position, c.TargetPos));
 }
Exemple #22
0
 /// <summary>
 /// Gets the maximum acceleration of the given camera.
 /// Default behavior: returns a flat acceleration of 2,000.
 /// </summary>
 public static float DefaultCamAccelFunction(CameraFollowScript c)
 {
     return(10);
 }