Esempio n. 1
0
    void Start()
    {
        pHud  = GetComponent <PlayerHUD>();
        death = GetComponent <Death>();
        if (photonView.IsMine)
        {
            dataManager = GetComponent <PlayerControllerLoader>().inGameDataManager;
        }

        // see if the player has the Resilience skill
        SkillLevel resilienceLevel = GetComponent <PlayerControllerLoader>().skillManager.GetSkillByName("Resilience");

        if (resilienceLevel != null)
        {
            // they have it, so set it
            skillModifier = resilienceLevel.Modifier;
            Debug.Log("Player has Resilience, modifier is: " + skillModifier);
        }
        else
        {
            Debug.Log("Player does NOT have Resilience");
        }

        currentHealth = (int)(maxHealth * skillModifier);
        Debug.Log("Player is starting with current health: " + currentHealth); // this may cause problems when we implement the medpack
    }
Esempio n. 2
0
    void Start()
    {
        inGameManager = GetComponent <PlayerControllerLoader>().inGameDataManager;
        pHud          = GetComponent <PlayerHUD>();

        inGameManager.OnEquipmentSwitched += EquipmentSwitched;
    }
    public override void Use(InGameDataManager manager)
    {
        // use medpack
        InGamePlayerManager pManager = FindObjectOfType <InGamePlayerManager>();
        GameObject          myPlayer = null;

        foreach (var player in pManager.players)
        {
            if (player.GetPhotonView().IsMine)
            {
                myPlayer = player;
            }
        }

        //myPlayer.GetPhotonView().RPC("StartHeal", RpcTarget.All);
        float difference = myPlayer.GetComponent <Health>().maxHealth - myPlayer.GetComponent <Health>().currentHealth;

        myPlayer.GetComponent <Health>().Heal((int)difference);

        // change the health in the UI as well
        myPlayer.GetComponent <PlayerHUD>().heal(difference);
        NotificationSystem.Instance.Notify(new Notification("Used Medpack", NotificationType.Good));

        // remove this from the manager
        manager.currentItem = null;
    }
Esempio n. 4
0
 // Start is called before the first frame update
 void Start()
 {
     animator = GetComponent <Animator>();
     manager  = GetComponentInParent <PlayerControllerLoader>().inGameDataManager;
     manager.OnEquipmentSwitched += EquipmentSwitched;
     slot = 0;
     if (Guns.GetChild(slot))
     {
         current = Guns.GetChild(slot);
     }
 }
Esempio n. 5
0
    void Start()
    {
        currentIndex  = -1;
        sceneManager  = GetComponent <PlayerSceneManager>();
        inGameManager = GetComponent <InGameDataManager>();

        equipment = new Equipment[5];
        //equipment[0] = weapons[(int)WeaponType.AR];
        equipment[0] = weapons[(int)WeaponType.Pistol];
        //weaponCounts[(int)WeaponType.AR]++;
        weaponCounts[(int)WeaponType.Pistol]++;

        resources   = new List <ResourcePersistent>();
        resourceSet = new HashSet <Resource>();
    }
    void Awake()
    {
        GameObject[] objs = GameObject.FindGameObjectsWithTag("GameController");
        foreach (var obj in objs)
        {
            if (obj.GetPhotonView().Owner.UserId == photonView.Owner.UserId)
            {
                playerController  = obj;
                baseDataManager   = obj.GetComponent <BaseDataManager>();
                inGameDataManager = obj.GetComponent <InGameDataManager>();
                sceneManager      = obj.GetComponent <PlayerSceneManager>();
                skillManager      = obj.GetComponent <SkillManager>();
            }
        }

        sceneManager.isInHomeBase = false;
        GameControllerSingleton.instance.aliveCount = PhotonNetwork.CurrentRoom.PlayerCount;
    }
    public override void Use(InGameDataManager manager)
    {
        InGamePlayerManager pManager = FindObjectOfType <InGamePlayerManager>();
        GameObject          myPlayer = null;

        foreach (var player in pManager.players)
        {
            if (player.GetPhotonView().IsMine)
            {
                myPlayer = player;
            }
        }
        // use energy drink
        myPlayer.GetComponent <PlayerMotor>().Energize(seconds);
        NotificationSystem.Instance.Notify(new Notification("Used Energy Drink", NotificationType.Good));

        // remove this from the manager?
        manager.currentItem = null;
    }
Esempio n. 8
0
    // Update is called once per frame
    void Update()
    {
        if (!photonView.IsMine)
        {
            return;
        }

        if (gameObject.activeSelf && Input.GetMouseButtonUp(0) && !thrown)
        {
            igdm = GetComponentInParent <Transform>().GetComponentInParent <PlayerControllerLoader>().inGameDataManager;
            Rigidbody rb = gameObject.AddComponent <Rigidbody>() as Rigidbody;
            rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
            thrown = true;
            Transform angleLooking = GetComponentInParent <Transform>();
            GetComponent <Rigidbody>().WakeUp();
            GetComponent <Rigidbody>().AddForce(angleLooking.forward * 500);
            GetComponent <Rigidbody>().useGravity     = true;
            GetComponentInParent <Transform>().parent = null;
            igdm.currentWeapons[3] = null;
            igdm.grenadeThrown();
            StartCoroutine(Explosion());
            r = rb;
        }
    }
Esempio n. 9
0
 // Start is called before the first frame update
 void Start()
 {
     animator = GetComponent <Animator>();
     manager  = GetComponentInParent <PlayerControllerLoader>().inGameDataManager;
     manager.OnEquipmentSwitched += EquipmentSwitch;
 }
Esempio n. 10
0
 public abstract void Use(InGameDataManager manager);