예제 #1
0
    void Awake()
    {
        if (gameObject.tag == "Player")
        {
            GetComponent <PlayerMovement>().moveSpeed = moveSpeed;
            enemyLayers = LayerMask.GetMask("enemies");
            GameObject.Find("GameManager").GetComponent <GameManager>().currentHost = "Worm";
        }
        else
        {
            enemyLayers = LayerMask.GetMask("Player");
        }

        transform.localScale = new Vector3(1, 1, 0);

        pa = GetComponent <PlayAnimations>();
        sr = GetComponent <SpriteRenderer>();
        am = GetComponent <Animator>();

        //Set the player animations/sprites to the current host creature
        pa.idleLeft  = idleLeft;
        pa.idleRight = idleRight;
        pa.walkLeft  = walkLeft;
        pa.walkRight = walkRight;
        pa.walkUp    = walkUp;
        pa.walkDown  = walkDown;
        pa.death     = death;
    }
예제 #2
0
    void Awake()
    {
        if (gameObject.tag == "Player")
        {
            GetComponent <PlayerMovement>().moveSpeed = moveSpeed;
            //Due to the sprite scaling when you change from a human to a ghost the capsule collider is too large to move horizontally though 1 unit tall corridors
            GetComponent <CapsuleCollider2D>().size = new Vector2(0.1f, 0.2f);
            isPlayer = true;

            GameObject.Find("GameManager").GetComponent <GameManager>().currentHost = "Ghost";
        }

        isPhasing = false;

        sr = GetComponent <SpriteRenderer>();

        transform.localScale = new Vector3(3.5f, 3.5f, 0);

        //Set the player animations/sprites to the current host creature
        pa           = GetComponent <PlayAnimations>();
        pa.idleLeft  = idleLeft;
        pa.idleRight = idleRight;
        pa.walkLeft  = walkLeft;
        pa.walkRight = walkRight;
        pa.walkUp    = walkUp;
        pa.walkDown  = walkDown;
        pa.death     = death;
    }
예제 #3
0
 void Start()
 {
     SR                 = GetComponent <SpriteRenderer>();
     an                 = GetComponent <Animator>();
     pa                 = GetComponent <PlayAnimations>();
     gameManager        = GameObject.Find("GameManager").GetComponent <GameManager>();
     shaker             = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Shaker>();
     equippedWeaponName = "Short Sword";
 }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     clickedobject = this.GetComponent <Clicked> ();
     gl            = GameObject.Find("ScriptGlobal").GetComponent <Global> ();
     pa            = this.GetComponent <PlayAnimations> ();
     ins           = this.GetComponent <InventorySystem> ();
     zio           = this.GetComponent <ZoomInOut> ();
     dt            = this.GetComponent <DragTurn> ();
     if (go == null)
     {
         go = this.gameObject;
     }
 }
예제 #5
0
    void Awake()
    {
        sr = GetComponent <SpriteRenderer>();

        //Set the player animations/sprites to the current host creature
        pa           = GetComponent <PlayAnimations>();
        pa.idleLeft  = idleLeft;
        pa.idleRight = idleRight;
        pa.walkLeft  = walkLeft;
        pa.walkRight = walkRight;
        pa.walkUp    = walkUp;
        pa.walkDown  = walkDown;
        pa.death     = death;
    }
예제 #6
0
    void Start()
    {
        gameManager.currentHost = "Human";

        rb           = GetComponent <Rigidbody2D>();
        playerAnim   = GetComponent <Animator>();
        shaker       = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Shaker>();
        player       = GameObject.FindGameObjectWithTag("Player");
        audioManager = GameObject.FindObjectOfType <AudioManager>();


        //This is the current set up i'm using for the weapons, needs improvement
        GameObject swordLoad =
            Instantiate(
                Resources.Load("SwordAim"),
                new Vector2(transform.position.x - 0.04f, transform.position.y + 0.05f),
                Quaternion.identity)
            as GameObject;

        swordLoad.transform.parent = transform;;
        swordLoad.name             = "SwordAim";

        swordAim = gameObject.transform.Find("SwordAim").gameObject;

        sword = swordAim.transform.GetChild(0).gameObject;
        swordAim.SetActive(true);
        swordAnim = sword.GetComponent <Animator>();

        transform.localScale = new Vector3(2.5f, 2.5f, 0);

        GetComponent <PlayerMovement>().moveSpeed = moveSpeed;

        //Set the player animations/sprites to the current host creature
        pa = GetComponent <PlayAnimations>();

        pa.idleLeft    = idleLeft;
        pa.idleRight   = idleRight;
        pa.walkLeft    = walkLeft;
        pa.walkRight   = walkRight;
        pa.walkUp      = walkUp;
        pa.walkDown    = walkDown;
        pa.death       = death;
        pa.attackLeft  = attackLeft;
        pa.attackRight = attackRight;
        pa.attackUp    = attackUp;
        pa.attackDown  = attackDown;
    }
예제 #7
0
 private void Start()
 {
     _playAnimations = GetComponent <PlayAnimations>();
 }
예제 #8
0
 private void Awake()
 {
     weapons        = new List <Weapon>();
     ShipInit       = GetComponent <ShipInit>();
     playAnimations = GetComponent <PlayAnimations>();
 }