private JustinEnemyMovement body;         //The motor of the body

    //Spawns the collider to detect collisions
    // Use this for initialization
    void Start()
    {
        visibilityCollider           = gameObject.AddComponent <BoxCollider2D>();
        visibilityCollider.offset    = new Vector2(2.5f, 0f);
        visibilityCollider.size      = new Vector2(sightDistance, 1f);
        visibilityCollider.isTrigger = true;
        body = mainBody.GetComponent <JustinEnemyMovement> ();
    }
Exemplo n.º 2
0
    public AudioSource audio;           //The shooting sound effect

    // Use this for initialization
    void Start()
    {
        gunTransform = GetComponent <Transform>();
        parent       = GameObject.Find("Bullets");
        player       = GetComponentInParent <JustinEnemyMovement>();
        timePassed   = attackSpeed;
        canAttack    = true;
    }
Exemplo n.º 3
0
    private bool movedUp;                   //Whether or not the weapon is currently elevated

    // Use this for initialization
    void Start()
    {
        playerSpotted = false;
        gettingChased = false;
        movedUp       = false;
        rigidBod      = GetComponent <Rigidbody2D>();
        controller    = GetComponent <JustinEnemyMovement>();
        GameObject weapon = getRandomWeapon();

        spawnedWeapon = Instantiate(weapon, spawn);

        isMelee = (spawnedWeapon.GetComponent <JustinEnemyGun>() == null);
        if (!isMelee)
        {
            GetComponent <JustinEnemyMovement>().usingGun           = true;
            spawnedWeapon.GetComponent <JustinEnemyGun>().enemyTag  = enemyTag;
            spawnedWeapon.GetComponent <JustinEnemyGun>().enemyMask = enemyMask;
        }
        else
        {
            //Means the weapon is a type of melee
            spawnedWeapon.GetComponent <JustinEnemyMelee>().enemyTag = enemyTag;
        }
    }
    private JustinEnemyMovement enemy; //The main body of the player

    // Use this for initialization
    void Start()
    {
        enemy = GetComponentInParent <JustinEnemyMovement>();
    }