Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        //Ignore collision with own Enemy layer
        Physics2D.IgnoreLayerCollision(0, 9);

        animator = this.GetComponent <Animator>();
        generalMovementScript = GameObject.FindGameObjectWithTag("GeneralScripts").GetComponent <GeneralMovement>();
        characterTexture      = GetComponent <Image>();
        gameObject.transform.GetChild(0).GetComponent <Image>();

        WeaponsEquipped.Add(new Pistol());

        //Init player weapon sprite
        playerWeapon = gameObject.transform.Find("PlayerWeapon");
        playerWeapon.GetComponent <Image>().sprite = WeaponsEquipped[CurrentWeapon].WeaponSprite;

        playerWeapon.localPosition = gameObject.transform.position;

        //Get player color
        spriteRenderer = GetComponent <SpriteRenderer>();
        defaultColour  = spriteRenderer.color;
        BerserkColour  = new Color(0.7803f, 0.1490f, 0.1490f, 1);
        PlayerPrefs.SetString("lastloadedscene", SceneManager.GetActiveScene().name);
        //Debug.Log(PlayerPrefs.GetFloat("respawntocheckpoint"));
        if (PlayerPrefs.GetFloat("respawntocheckpoint") >= 1)
        {
            transform.position = new Vector3(PlayerPrefs.GetFloat("respawnhere"), PlayerPrefs.GetFloat("respawnhere1"), 0);
            PlayerPrefs.DeleteKey("respawntocheckpoint");
            PlayerPrefs.DeleteKey("savecheckpoint");
        }
    }
Ejemplo n.º 2
0
 private void Awake()
 {
     m_movement         = GetComponent <GeneralMovement>();
     navMeshAgent       = GetComponent <NavMeshAgent>();
     cameraCover        = GetComponent <CameraCover>();
     m_movement.enabled = false;
 }
Ejemplo n.º 3
0
    public void BulletObjectInit()
    {
        generalMovementScript = GameObject.FindGameObjectWithTag("GeneralScripts").GetComponent <GeneralMovement>();
        enemyManager          = GameObject.FindGameObjectWithTag("EnemyManager").GetComponent <EnemyManager>();
        Destination           = new Vector3(0, 0, 0);

        theCharacter = GameObject.FindGameObjectWithTag("MainCharacter").GetComponent <CharacterObject>();
    }
Ejemplo n.º 4
0
    private void Awake()
    {
        movement = this.GetComponent <GeneralMovement>();
        this.gameObject.layer = LayerMask.NameToLayer("Player");


        SetupControls();
        AssignCompletionFunction();
    }