Пример #1
0
    protected override void  InitializeActor()
    {
        base.InitializeActor();

        bCanPickupItems     = true;
        bItemsCauseEffects  = true;
        bCanModifyVisibilty = true;

        if (cameraPrototype == null)
        {
            Debug.Log("ERROR!       Player actor " + name + " has no camera prototype!");
            return;
        }
        myCamera = (PlayerCamera)GameObject.Instantiate(cameraPrototype, transform.position + new Vector3(0.0f, 0.0f, -10.0f), transform.rotation);
        if (myCamera != null)
        {
            myCamera.InitailizeCamera(this);
        }
        else
        {
            Debug.Log("ERROR!       Player actor " + name + " failed to initialize its camera because it couldn'y instantiate it!");
        }

        ui = GetComponent <UI_PlayerBase>();
        if (ui == null)
        {
            Debug.Log("WARNING!       Player actor " + name + " doesn't have any UI component!");
        }

        // Tries to find a UI menu to use as the players inventory menu
        inventoryMenu = GameObject.FindObjectOfType <UI_InventoryMenu>();
        if (inventoryMenu == null)
        {
            Debug.Log("WARNING!       Player actor " + name + " could not find a UI_InventoryMenu in the scene!");
        }
        else
        {
            inventoryMenu.gameObject.SetActive(false);
        }

        // HACK: temporarily adding some abilities. haven't decided how this will actually work yet
        abilities.Add(new Ability_HunterAttack()); // Main attack ability in first place

        abilities.Add(new Ability_Invisibility());
        abilities.Add(new Ability_PlaceTrap());
        abilities.Add(new Ability_TossBomb());
        abilities.Add(new Ability_Slash());

        // Player always has the cap fire ability
        abilities.Add(new Ability_CreateFirePit());

        //// TEMP: give the player some stuff in their inventory and try equipping the sword
        //inventory.Add(new Sword());
        //inventory.Add(new Bow());
        //EquipWeapon((Weapon)inventory[0]);

        ui.InitializeUI();
    }
Пример #2
0
    protected override void InitializeActor()
    {
        base.InitializeActor();

        bCanPickupItems = true;
        bItemsCauseEffects = true;
        bCanModifyVisibilty = true;

        if(cameraPrototype == null) {
            Debug.Log("ERROR!       Player actor "+name+" has no camera prototype!");
            return;
        }
        myCamera = (PlayerCamera)GameObject.Instantiate(cameraPrototype, transform.position + new Vector3(0.0f, 0.0f, -10.0f), transform.rotation);
        if(myCamera != null) {
            myCamera.InitailizeCamera(this);
        }
        else {
            Debug.Log("ERROR!       Player actor "+name+" failed to initialize its camera because it couldn'y instantiate it!");
        }

        ui = GetComponent<UI_PlayerBase>();
        if(ui == null) {
            Debug.Log("WARNING!       Player actor " + name + " doesn't have any UI component!");
        }

        // Tries to find a UI menu to use as the players inventory menu
        inventoryMenu = GameObject.FindObjectOfType<UI_InventoryMenu>();
        if(inventoryMenu == null) {
            Debug.Log("WARNING!       Player actor " + name + " could not find a UI_InventoryMenu in the scene!");
        }
        else {
            inventoryMenu.gameObject.SetActive(false);
        }

        // HACK: temporarily adding some abilities. haven't decided how this will actually work yet
        abilities.Add(new Ability_HunterAttack()); // Main attack ability in first place

        abilities.Add(new Ability_Invisibility());
        abilities.Add(new Ability_PlaceTrap());
        abilities.Add(new Ability_TossBomb());
        abilities.Add(new Ability_Slash());

        // Player always has the cap fire ability
        abilities.Add(new Ability_CreateFirePit());

        //// TEMP: give the player some stuff in their inventory and try equipping the sword
        //inventory.Add(new Sword());
        //inventory.Add(new Bow());
        //EquipWeapon((Weapon)inventory[0]);

        ui.InitializeUI();
    }