Inheritance: MonoBehaviour
	void Start () 
	{
		instance = this; 
		curWeapon = 0;
		curWepList [curWeapon].gameObject.SetActive (true);
		GetComponent<AudioSource>().PlayOneShot(curWepList[curWeapon].weapon.draw);
		curWepList[curWeapon].DrawGun ();
	}
	void Start()
	{
		controller = GetComponent<CharacterController2D>();
		weaponManager = GetComponentInChildren<WeaponManager>();
		anim = GameObject.Find("Player").GetComponent<Animator>();

		InvokeRepeating("BroadcastCurrentPosition", .3f, .3f);
	}
Beispiel #3
0
 protected virtual void Init()
 {
     weaponManager = GetComponent<WeaponManager> ();
     movementManager = GetComponent<MovementManager> ();
     healthManager = GetComponent<HealthManager> ();
     spriteRenderer = GetComponent<SpriteRenderer> ();
     healthManager.Killed += OnKilled;
 }
 // Use this for initialization
 void Start()
 {
     weaponManager = (WeaponManager) GetComponent<WeaponManager> ();
     fire_1_held = false;
     fire_2_held = false;
     isLooping = false;
     speed = minSpeed;
 }
Beispiel #5
0
 void Awake()
 {
     rb2d = GetComponent<Rigidbody2D>();
     anim = GetComponent<Animator>();
     movement = GetComponent<Moveable>();
     spriteRenderer = GetComponent<SpriteRenderer>();
     weaponManager = GetComponent<WeaponManager>();
 }
Beispiel #6
0
    void Start()
    {
        //initalize the needed scripts script
        wpnManager = GetComponent <WeaponManager>();
        playerHealth = GetComponent <PlayerHealth>();
        playerMovement = GetComponent <PlayerMovement>();

        chargedRing.fillAmount = 0f;
    }
	void OnTriggerEnter2D(Collider2D collider)
	{
		if (disable)return;
		if (collider.transform.parent == null)return;

		weaponmanager = collider.transform.parent.GetComponentInChildren<WeaponManager>();

		if (weaponmanager != null)
		{
			disable = true;
			Invoke("Remove", 0.1f);
		}
	}
Beispiel #8
0
 void Awake()
 {
     _instance = this;
     enemyPositions = new List<Vector3>();
     //if (player.gameObject != null)
     //{
     //    player = GameObject.FindGameObjectWithTag(Tags.player).transform;
     //}
     //if (enemy.gameObject != null)
     //{
     //    enemy = GameObject.FindGameObjectWithTag(Tags.enemy).transform;
     //}
 }
	public void SetDevice( PlayerDevice device )
	{
		this.device = device;
		unitstats = gameObject.GetComponent<UnitStats>();
		movement = gameObject.GetComponent<Movement>();
		skeletonAnimation = gameObject.GetComponentInChildren<SkeletonAnimation>();
		skeletonAnimation.state.Event += Event;
		skeletonAnimation.UpdateBones += UpdateBones;
		skeletonAnimation.state.End += End;
		head = gameObject.GetComponentInChildren<SkeletonAnimation>().skeleton.FindBone("head");
		hip = gameObject.GetComponentInChildren<SkeletonAnimation>().skeleton.FindBone("body");
		weaponmanager = gameObject.GetComponentInChildren<WeaponManager>();
		meleemanager = gameObject.GetComponentInChildren<MeleeManager>(); 
		GameObject gameGameObject = GameObject.FindGameObjectWithTag( "Level" );
		level = gameGameObject.GetComponent<LevelInfo>(); 
	}
Beispiel #10
0
    void Start()
    {
        // DontDestroyOnLoad(gameObject);
        MaxAmmo = 50;
        _UI     = player.GetComponent <WeaponManager>();
        motor   = player.GetComponent <PlayerMotor>();
        point   = _SpawnPoint.GetComponent <SpawnPoint>();
        shoot   = player.GetComponent <PlayerShoot>();

        //if (Mode)
        //    _SpawnPoint.SetActive(true);
        //else if (!Mode)
        //    SpawnRandomPoints.SetActive(true);

        //  HealthCanvas.GetComponent<GUIText>().text = "asdasd";
    }
Beispiel #11
0
        void Start()
        {
            weaponManager = GameManager.Instance.WeaponManager;
            var player = GameManager.Instance.PlayerObject;

            Kicker                = player.AddComponent <FPSWeapon>();
            Kicker.WeaponType     = WeaponTypes.Melee;
            Kicker.ShowWeapon     = false;
            Kicker.FlipHorizontal = weaponManager.ScreenWeapon.FlipHorizontal;
            mainCamera            = GameObject.FindGameObjectWithTag("MainCamera");
            playerLayerMask       = ~(1 << LayerMask.NameToLayer("Player"));
            SetKickKeyFromText(BindText);
            timeSinceLastKick = messageCooldownTime;
            isDamageFinished  = false;
            consoleController = GameObject.Find("Console").GetComponent <ConsoleController>();
        }
 protected override void Start()
 {
     isPlayerDead = false;
     groundLayer  = 1 << LayerMask.NameToLayer("Ground");
     speed        = EntityData.PLAYER_SPEED;
     setHealthPoint(EntityData.PLAYER_HP);
     rigid         = GetComponent <Rigidbody>();
     animator      = GetComponent <Animator>();
     inputManager  = GameObject.Find("InputManager").GetComponent <InputManager>();
     weaponManager = GameObject.Find("WeaponManager").GetComponent <WeaponManager>();
     setHealthPoint(EntityData.PLAYER_HP);
     HPslider.maxValue = EntityData.PLAYER_HP;
     HPslider.value    = EntityData.PLAYER_HP;
     setPlayerInfo();
     StartCoroutine(recoverHP());
 }
 void Awake()
 {
     _movement                = GetComponent <Movement>();
     _shoot                   = GetComponent <ShootRifle>();
     _shotGun                 = GetComponent <ShotGun>();
     _health                  = GetComponent <CharacterHealth>();
     _manager                 = GetComponent <WeaponManager>();
     _baseWeapon              = GetComponent <BaseWeapon>();
     _shield                  = GetComponent <Shield>();
     _health.OnUnitDied      += OnPlayerDied;
     _health.OnHealthChanged += OnHealthChanged;
     GameController.GameControllerInstance.playerTransform  = transform;
     GameController.GameControllerInstance.playerGameobject = gameObject;
     //_shoot.hitLayerShoot = enemyLayer;
     //_shotGun.hitLayerShoot = enemyLayer;
     _baseWeapon.hitLayerShoot = enemyLayer;
 }
Beispiel #14
0
 //Awake is always called before any Start functions
 void Awake()
 {
     //Check if instance already exists
     if (instance == null)
     {
         //if not, set instance to this
         instance = this;
     }
     //If instance already exists and it's not this:
     else if (instance != this)
     {
         //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
         Destroy(gameObject);
     }
     //Sets this to not be destroyed when reloading scene
     InitializeWeapons();
 }
Beispiel #15
0
    //pickup weapons
    public void SetWeaponsItemPriority()
    {
        List <int> weaponsPriorities = new List <int>();

        if (aiWeaponLogic.itemWeapons.Count == 0)
        {
            pickWeaponPriority = 0;
            return;
        }

        int highestPriority = 0;

        foreach (GameObject weapon in aiWeaponLogic.itemWeapons)
        {
            WeaponManager manager        = weapon.GetComponent <WeaponManager>();
            float         distanceFromMe = aiMapLogic.GetDistance(aiBase.gameObject, weapon);
            float         distanceFactor = aiMapLogic.GetDistanceFactor(distanceFromMe);

            int priority = 0;
            switch (manager.type)
            {
            case WeaponEnum.flamethrower:
                float flamethrowerFactor = distanceFactor;
                priority = (int)flamethrowerFactor * 10;
                break;

            default:
                priority = 0;
                break;
            }
            if (priority == 0)
            {
                priority = 10;
            }
            weaponsPriorities.Add(priority);

            if (weaponsPriorities[weaponsPriorities.Count - 1] > highestPriority)
            {
                highestPriority = weaponsPriorities[weaponsPriorities.Count - 1];
            }
        }

        aiWeaponLogic.bestWeaponItem = aiWeaponLogic.itemWeapons[weaponsPriorities.IndexOf(highestPriority)];

        pickWeaponPriority = highestPriority;
    }
    // We need to do some checking.
    void Start()
    {
        // We will check that the camera is referenced.
        if (cam == null)
        {
            // If the camera is not referenced, we will throw an exeception.
            Debug.LogError("PlayerShoot: No camera referenced!");
            // Disable this script.
            this.enabled = false;
        }

        // Set the WeaponGFX layer.
        //weaponGFX.layer = LayerMask.NameToLayer(weaponLayerName);

        // Instantiate the WeaponManager.
        weaponManager = GetComponent <WeaponManager>();
    }
Beispiel #17
0
    // Use this for initialization
    void Awake()
    {
        // Set the singleton instance
        GameManager.instance = this;

        // Load other managers
        // PS: We don't make them as a game components, because we want them to be only accessible through the GameManager instance


        // Load and initialize InputManager
        this.inputManager = new InputManager(this);

        //Load and initialize WeaponManager
        this.weaponManager = new WeaponManager(this);

        this.weaponSelectionManager = new WSelectionManager(this);
    }
Beispiel #18
0
        /// <summary>
        /// Loads and returns the owned weapons
        /// </summary>
        /// <returns></returns>
        internal ConcurrentDictionary <string, Weapon> LoadAndReturnWeapons()
        {
            DataTable Weps = null;
            ConcurrentDictionary <string, Weapon> Weapons = new ConcurrentDictionary <string, Weapon>();

            Weapons.Clear();

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `rp_weapons_owned` WHERE `user_id` = '" + this.mId + "'");
                Weps = dbClient.getTable();
                uint id = 0;

                if (Weps != null)
                {
                    foreach (DataRow Row in Weps.Rows)
                    {
                        id++;

                        string basename = Convert.ToString(Row["base_weapon"]);
                        string name     = Convert.ToString(Row["name"]);
                        int    mindam   = Convert.ToInt32(Row["min_damage"]);
                        int    maxdam   = Convert.ToInt32(Row["max_damage"]);
                        int    range    = Convert.ToInt32(Row["range"]);
                        bool   canuse   = Convert.ToBoolean(Row["can_use"]);

                        if (!Weapons.ContainsKey(basename))
                        {
                            Weapon BaseWeapon = WeaponManager.getWeapon(basename);

                            if (BaseWeapon != null)
                            {
                                Weapon Weapon = new Weapon(id, basename, name, BaseWeapon.FiringText, BaseWeapon.EquipText, BaseWeapon.UnEquipText, BaseWeapon.ReloadText, BaseWeapon.Energy, BaseWeapon.EffectID, BaseWeapon.HandItem, range, mindam, maxdam, BaseWeapon.ClipSize, BaseWeapon.ReloadTime, BaseWeapon.Cost, BaseWeapon.CostFine, BaseWeapon.Stock, BaseWeapon.LevelRequirement, canuse);

                                if (Weapon != null)
                                {
                                    Weapons.TryAdd(basename, Weapon);
                                }
                            }
                        }
                    }
                }
            }

            return(Weapons);
        }
Beispiel #19
0
        void Awake()
        {
            playerEnterExit = GetComponent <PlayerEnterExit>();
            if (!playerEnterExit)
            {
                throw new Exception("PlayerEnterExit not found.");
            }

            playerCamera = GetComponentInChildren <Camera>();
            if (!playerCamera)
            {
                throw new Exception("Player Camera not found.");
            }

            playerMouseLook = playerCamera.GetComponent <PlayerMouseLook>();
            if (!playerMouseLook)
            {
                throw new Exception("PlayerMouseLook not found.");
            }

            playerMotor = GetComponent <PlayerMotor>();
            if (!playerMotor)
            {
                throw new Exception("PlayerMotor not found.");
            }

            playerEntityBehaviour = GetComponent <DaggerfallEntityBehaviour>();
            if (!playerEntityBehaviour)
            {
                throw new Exception("PlayerEntityBehaviour not found.");
            }

            weaponManager = GetComponent <WeaponManager>();
            if (!weaponManager)
            {
                throw new Exception("WeaponManager not found.");
            }

            transportManager = GetComponent <TransportManager>();
            if (!transportManager)
            {
                throw new Exception("TransportManager not found.");
            }

            SaveLoadManager.RegisterSerializableGameObject(this);
        }
Beispiel #20
0
        public override void Awake()
        {
            base.Awake();
            destructible          = GetComponent <CharDestructible>();
            destructible.onDeath += () => StartCoroutine(dieRoutine());
            destructible.user     = user;
            destructible.setVisible(true);

            levitator = GetComponent <Levitator>();

            weaponManager = GetComponent <WeaponManager>();
            weaponManager.setUser(user);

            _viewpoint.hud.AddHudComponent(weaponManager.hudComponent);

            _viewpoint.radar.addToWhitelist(destructible);
        }
    // Start is called before the first frame update
    void Start()
    {
        //getting all the needed components, that we want to change/modify later
        myWeaponManager    = GetComponent <WeaponManager>();
        myHealthScript     = GetComponent <HealthScript>();
        myControllerScript = GetComponent <PlayerController>();

        //applying all the stats
        //note: this overwrites these bitches so far: movementSpeed, maxHealth, and the weapon stat multipliers
        for (int i = 0; i < skillStats.Count; i++)
        {
            ApplyStatChange(skillStats[i].name);
        }

        //setting the starting health for the player, after setting the maxHealthStat
        myHealthScript.HealToMax();
    }
Beispiel #22
0
    private void Start()
    {
        FindObjectOfType <animationController>().equipFlash += CanShoot;
        Mag = Gun.Magzine;
        if (cam == null)
        {
            Debug.LogError("PlayerShoot : No camera component");
            this.enabled = false;
        }
        originalRotation = transform.localEulerAngles;

        // weaponGFX.layer = LayerMask.NameToLayer(weaponLayerName);//assign layer to weaponGFX
        weaponManager = GetComponent <WeaponManager>();
        playerMotor   = GetComponent <PlayerMotor>();
        rb            = GetComponent <Rigidbody>();
        WeaponGraphics gra = weaponManager.GetCurrentWeaponGraphics();
    }
Beispiel #23
0
    public void SetWeaponManager(WeaponManager wep)
    {
        weapon = wep;

        switch (weapon.GetTypeOfWeapon())
        {
        case TypeOfWeapon.Fist:
            sword.SetActive(false);
            shield.SetActive(false);
            break;

        default:
            sword.SetActive(true);
            shield.SetActive(true);
            break;
        }
    }
Beispiel #24
0
        /// <summary>
        ///     Sets up the UI
        /// </summary>
        /// <param name="playerManager"></param>
        public void SetupUI(PlayerManager playerManager)
        {
            //Reset this
            IsPauseMenuOpen = false;

            hud.Setup(this);

            PlayerManager = playerManager;
            WeaponManager = playerManager.GetComponent <WeaponManager>();

            pauseMenu.gameObject.SetActive(false);

            scoreBoardObject.SetActive(false);
            scoreBoardObject.GetComponent <ScoreBoard.ScoreBoard>().clientPlayer = playerManager;

            Logger.Debug("The ClientUI is now ready.");
        }
    private void OnEnable()
    {
        audioSource = GetComponent <AudioSource>();
        animator    = GetComponent <Animator>();

        weapon = GetComponentInChildren <WeaponManager>();
        ShieldScript shield = GetComponentInChildren <ShieldScript>();

        if (shield != null)
        {
            this.shield = shield.gameObject;
        }

        weapon.gameObject.SetActive(false);
        head   = animator.GetBoneTransform(HumanBodyBones.Head);
        states = GetComponentInParent <StatesManager>();
    }
Beispiel #26
0
    // Use this for initialization
    void Start()
    {
        animator   = transform.GetComponentInChildren <Animator>();
        shootable  = true;
        useGravity = true;

        if (animator == null)
        {
            Debug.LogError("Didn't find animator!");
        }

        weaponID = 1;

        myRigidBody = GetComponent <Rigidbody2D>();

        weaponManager = GetComponent <WeaponManager>();
    }
Beispiel #27
0
	void Start () {
		agent = GetComponentInChildren<NavMeshAgent> ();
		charMove = GetComponent<CharMove> ();
		anim = GetComponent<Animator> ();
		weaponManager = GetComponent<WeaponManager> ();

		//Retreives waypoints' transforms from a game object containing them
		if (waypointHolder) {
			Transform[] wayp = waypointHolder.GetComponentsInChildren<Transform> ();

			foreach (Transform tr in wayp) {
				if (tr != waypointHolder.transform) {
					waypoints.Add (tr);
				}
			}
		} 
	}
Beispiel #28
0
    // Use this for initialization
    void Start()
    {
        inputManager           = GameManager.getInstance().getInputManager();
        weaponManager          = GameManager.getInstance().getWeaponManager();
        weaponSelectionManager = GameManager.getInstance().getWSelectionManager();

        //Creates a pool for weapons
        weaponManager.CreatePool(weaponSelectionManager.getMainWeapon(), 100);
        weaponManager.CreatePool(weaponSelectionManager.getAltWeapon(), 10);

        // If view is ours, attach us to the input manager
        if (photonView.isMine)
        {
            // Subscribe to all shooting input events
            inputManager.subscribeToInputGroup(EInputGroup.ShootingInput, this);
        }
    }
Beispiel #29
0
    public void RunStart()
    {
        if (mpReferenceOnly)
        {
            return;
        }

        PlayerReference pr = GeneralVariables.playerRef;

        pl  = pr.GetComponent <PlayerLook>();
        pm  = pr.GetComponent <PlayerMovement>();
        wm  = pr.wm;
        dm  = pr.dm;
        ac  = pr.ac;
        acs = pr.acs;
        tss = firePos.GetComponent <TimeScaleSound>();

        UIController uiController = GeneralVariables.uiController;

        curAmmoDisplay  = uiController.curAmmoDisplay;
        ammoLeftDisplay = uiController.ammoLeftDisplay;
        ammoBar         = uiController.ammoBar;
        crosshair       = uiController.crosshairs;

        if (muzzleLight != null)
        {
            muzzleBrightness = muzzleLight.intensity;
        }

        initializeTime = Time.time;
        PoolManager.Instance.Initialize();
        gunVisuals       = GetComponent <GunVisuals>();
        shootImpulseGUI  = 1f;
        reloadImpulseGUI = 1f;

        pa       = GetComponent <PistolAnim>();
        maxIndex = 2;
        SwitchFiringMethod();
        flashlightOn  = false;
        startCounting = false;
        fireCount     = 0;
        asm           = 1f;
        spreadReal    = baseSpreadAmount;
        bsna          = baseSpreadAmount;
    }
Beispiel #30
0
 void Start()
 {
     wb         = FindObjectOfType <WeaponBench>();
     fwanimator = GameObject.FindGameObjectWithTag("FadeWall").GetComponent <Animator>();
     altar      = FindObjectOfType <Altar>();
     //resUnit = altar.GetResUnit();
     ic            = FindObjectOfType <InputController>();
     weaponmanager = FindObjectOfType <WeaponManager>();
     sc            = FindObjectOfType <SpawnController>();
     aso           = gameObject.GetComponent <AudioSource>();
     sl            = FindObjectOfType <SoundLibrary>();
     statl         = FindObjectOfType <StatLibrary>();
     unit          = gameObject.GetComponent <Unit>();
     unit.SetDeadClip(sl.GetPlayerDead());
     ownedWeaponGOs = new List <GameObject>();
     previousWeapon = FindObjectOfType <PlayerWeapon>().name;
     ownedWeaponGOs.Add(sc.provideGameObject("BoneBag"));
 }
Beispiel #31
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (DialogWindow.Instance().isDialogWindowActive())
         {
             DialogWindow.Instance().Close();
             if (WeaponManager.Instance().IsGameFinished)
             {
                 goBack();
             }
         }
         else
         {
             showQuitWindow();
         }
     }
 }
Beispiel #32
0
        public override void TryGetHurt(WeaponManager wm, bool counterbackEnable, Vector3 pos)
        {
            if (wm.GetActorManager().GetCurrentStateName() == (byte)ProjectConstant.PlayerState.BACK_STAB)
            {
                actorController.IssueTrigger(ProjectConstant.AnimatorParameter.HIT);
                actorController.IssueBool(ProjectConstant.AnimatorParameter.STAFF_STUNED);
                stateManager.StaffStuned(5f);
            }

            if (!stateManager.AddHP(-GetHurtDamage(wm.GetDamage())))
            {
                actorController.IssueTrigger(ProjectConstant.AnimatorParameter.DIE);
                battleManager.Enable(false);
            }

            DamageUIManager.Instance.SetDamage((int)GetHurtDamage(wm.GetDamage()), pos,
                                               wm.IsCrit ? ColorSet.critColor : ColorSet.normalColor);
        }
    // Start is called before the first frame update
    void Start()
    {
        cam                 = Camera.main;
        charStats           = FindObjectOfType <CharacterStats>();
        cameraLock          = FindObjectOfType <CameraLock>();
        anim                = GetComponent <Animator>();
        characterController = GetComponent <CharacterController>();
        weaponManager       = transform.GetComponentInChildren <WeaponManager>();
        m_cameraLock        = cameraLock.GetCameraLock();
        if (charStats.GetHavingWeapon().ToString() != Weapon.Armed.ToString())
        {
            weaponBack.transform.Find(charStats.GetHavingWeapon().ToString()).gameObject.SetActive(true);
        }


        defaultPlayerHeight = characterController.height;
        defaultPlayerCenter = characterController.center;
    }
    private void Awake()
    {
        playerWeaponManager = transform.parent.parent.GetComponent <HUDManager>().GetPlayer().GetComponent <WeaponManager>();

        playerAttacks = playerWeaponManager.GetAttacks();

        for (int i = 0; i < playerAttacks.Length; i++)
        {
            weaponSlots[i].gameObject.SetActive(true);
            weaponSlots[i].weaponImage.sprite = playerAttacks[i].GetSprite();
        }

        currentWeapon = 0;
        if (weaponSlots.Length > 0)
        {
            weaponSlots[0].SelectWeapon();
        }
    }
Beispiel #35
0
    public void Awake()
    {
        _dynamicGameObjects      = GameObjectEx.Find(GameObjectNames.DynamicObjects);
        _playerGameObject        = GameObjectEx.FindGameObjectWithTag(GameObjectTags.Player);
        _toMoveDirectionRotation = GetComponent <ToMoveDirectionRotation>();
        _toTargetObjectRotation  = GetComponent <ToTargetObjectRotation>();

        var shadowLayer = Layers.GetLayer(LayerName.ShadowLayer);

        _layerMask     = (1 << shadowLayer) | (1 << Layers.GetLayer(LayerName.Player));
        _moveScript    = GetComponent <MoveScript>();
        _weaponManager = GetComponentInChildren <WeaponManager>();

        if (_weaponManager == null)
        {
            Debug.LogError("Weapon manager not found in child objects.");
        }
    }
Beispiel #36
0
    // Use this for initialization
    void Start()
    {
        GameObject gameStatusObj = GameObject.Find("GameStatus");

        if (gameStatusObj)
        {
            gameStatus = gameStatusObj.GetComponent <GameStatus> ();
        }
        status        = GameObject.FindGameObjectWithTag("Player").GetComponent <Status>();
        inventory     = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>();
        weaponmanager = GameObject.FindGameObjectWithTag("Player").GetComponent <WeaponManager>();
        ammoCounter   = transform.Find("AmmoCounter").GetComponent <Text>();
        playerHealth  = transform.Find("HealthSlider").GetComponent <Slider>();
        playerArmor   = transform.Find("ArmorSlider").GetComponent <Slider>();
        enemyCount    = transform.Find("EnemyCount").GetComponent <Text> ();
        endUI         = transform.Find("EndUI").gameObject;
        endUI.SetActive(false);
    }
Beispiel #37
0
    // Use this for initialization
    void Start()
    {
        if (!UIExists)
        {
            UIExists = true;
            DontDestroyOnLoad(transform.gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        thePS          = GetComponent <PlayerStats> ();
        theWeapon      = FindObjectOfType <WeaponManager> ();
        amountOfArrows = FindObjectOfType <Arrows> ();
        theEHM         = FindObjectOfType <EnemyHealthManager> ();
        theHE          = FindObjectOfType <HurtEnemy> ();
    }
Beispiel #38
0
    private void Start()
    {
        _uiManager       = UiManager.GetInstance();
        _weaponManager   = WeaponManager.GetInstance();
        _assembleManager = AssembleManager.GetInstance();

        var weaponId = _assembleManager.GetWeaponId();

        _primary   = new Weapon(_weaponManager.GetWeaponData(weaponId.primary), transform);
        _secondary = new Weapon(_weaponManager.GetWeaponData(weaponId.secondary), transform);

        _primary.ShowWeaponName();
        _secondary.ShowWeaponName();

        _current = _primary;
        _uiManager.SetWeaponName(_current.WeaponName);
        _uiManager.UpdateAmmoDisplay(_current.CurrentAmmo, _current.MaxAmmo);
    }
Beispiel #39
0
 private void OnEnable()
 {
     m_Target                   = (target as WeaponManager);
     m_FPController             = serializedObject.FindProperty("m_FPController");
     m_CameraTransformReference = serializedObject.FindProperty("m_CameraTransformReference");
     m_InteractionRadius        = serializedObject.FindProperty("m_InteractionRadius");
     m_WeaponSwitchMode         = serializedObject.FindProperty("m_WeaponSwitchMode");
     m_AmmoTag                  = serializedObject.FindProperty("m_AmmoTag");
     m_AdrenalinePackTag        = serializedObject.FindProperty("m_AdrenalinePackTag");
     m_EquippedWeaponsList      = serializedObject.FindProperty("m_EquippedWeaponsList");
     m_ItemPickupSound          = serializedObject.FindProperty("m_ItemPickupSound");
     m_ItemPickupVolume         = serializedObject.FindProperty("m_ItemPickupVolume");
     m_FastChangeWeapons        = serializedObject.FindProperty("m_FastChangeWeapons");
     m_WeaponList               = serializedObject.FindProperty("m_WeaponList");
     m_DefaultWeapon            = serializedObject.FindProperty("m_DefaultWeapon");
     m_FragGrenade              = serializedObject.FindProperty("m_FragGrenade");
     m_Adrenaline               = serializedObject.FindProperty("m_Adrenaline");
 }
    protected override void Awake()
    {
        ID = (int)PlayerStates.ID.Normal;
        base.Awake();

        m_Health        = GetComponent <Health> ();
        m_Body          = GetComponent <MovingObject> ();
        m_WeaponManager = GetComponent <WeaponManager> ();

        m_ActionMoveLeft        = new UnityAction <CommandModifier> (MoveLeft);
        m_ActionMoveRight       = new UnityAction <CommandModifier> (MoveRight);
        m_ActionMoveStopt       = new UnityAction <CommandModifier> (MoveStop);
        m_ActionFire            = new UnityAction <CommandModifier> (Fire);
        m_ActionLaser           = new UnityAction <CommandModifier> (Laser);
        m_ActionShield          = new UnityAction <CommandModifier> (Shield);
        m_ActionGodState        = new UnityAction <CommandModifier> (GodState);
        m_ActionAutodestruction = new UnityAction <CommandModifier> (Autodestruction);
    }
Beispiel #41
0
	void Awake(){

		weaponManager = GameObject.Find ("WeaponManagerContainer").GetComponent<WeaponManager>();
		WeaponAPrefab = weaponManager.ASetter;
		WeaponWPrefab = weaponManager.WSetter;
		WeaponDPrefab = weaponManager.DSetter;
		WeaponSPrefab = weaponManager.SSetter;

		//instantiate weapons
		if (WeaponAPrefab != null)
			WeaponA = Instantiate (WeaponAPrefab);
		if (WeaponWPrefab != null)
			WeaponW = Instantiate (WeaponWPrefab);
		if (WeaponDPrefab != null)
			WeaponD = Instantiate (WeaponDPrefab);
		if (WeaponSPrefab != null)
			WeaponS = Instantiate (WeaponSPrefab);
		
	}
Beispiel #42
0
	void Start ()
	{
		if (Camera.main != null) {
			cam = Camera.main.transform;
		}

		character = GetComponent<CharMove> ();

		anim = GetComponent<Animator> ();



		weaponManager = GetComponent<WeaponManager> ();

		col = GetComponent<CapsuleCollider> ();
		startHeight = col.height;

		cameraFunctions = Camera.main.GetComponentInParent<FreeCameraLook> ();

		offsetCross = cameraFunctions.crosshairOffsetWiggle;
	}
Beispiel #43
0
    void Awake()
    {
        //There can be only one
        if(Master == null)
        {
            DontDestroyOnLoad(gameObject);
            Master = this;

            playerData = transform.GetComponent<PlayerData> ();
            WeaponMngr = GetComponent<WeaponManager>();

            //Load all sectors
            Sector[] sectorObjects = Resources.LoadAll<Sector>("Sectors/");
            foreach (Sector s in sectorObjects)
                Sectors[s.name] = s;
        }
        else if(Master != this)
        {
            Destroy(gameObject);
        }
    }
Beispiel #44
0
    //в авейке все это работает плохо
    protected void Start()
    {
        //Debug.Log("WeaponSelector Start");

        debugmanager = GameObject.Find("DebugManager").GetComponent<DebugManager>();

        uimanager = GameObject.Find("UIManager").GetComponent<UIManager>();
        uimanager.OnCall_WSelector += MoveandAppeare;
        uimanager.OnCloseGUI += Disappeare;
        uimanager.OnPress_WButton += ShowRadius;
        uimanager.OnCloseGUI += HideRadius;
        _transform = transform;
        _gameObject = gameObject;
        _gameObject.SetActive(false);

        _weaponmanager = _camera.GetComponent<WeaponManager>();
        _resourceManager = _camera.GetComponent<ResourceManager>();

        radiusGM = GameObject.Find("Radius");
        radiusT = radiusGM.transform;

        foreach (Transform t in _transform)
        {
            if (t.name.Contains("WButton"))
            {
                SelectorButton button = t.GetComponent<SelectorButton>();
                WeaponType weapondata = _weaponmanager.GetPrimaryWeaponData(button.id);
                //Debug.Log("but " + id);

                if (weapondata != null)
                {
                    button.SetWButtonState(weapondata);
                }
                else
                {
                    button.SetButtonLock(LockSprite);
                }
            }
        }
    }
 void Start()
 {
     state = GetComponent<IPlayerStateFullAccess>();
     controller = GetComponent<CharacterController2D>();
     weaponManager = GetComponentInChildren<WeaponManager>();
     SetCharacterAnimations(state.Character);
 }
    //public ParticleSystem particleSys;
    //public AudioSource audioSource;
    void Start()
    {
        if (Camera.main != null)
        {
            playerCamera = Camera.main.transform;
        }
        else
        {
            print("Unable to locate main camera!");
        }

        characterMove = GetComponent<CharacterMovement>();

        weaponManager = GetComponent<WeaponManager>();

        animator = GetComponent<Animator>();
    }
 void OnEnable()
 {
     _weaponMan = (WeaponManager)target;
 }
    void Start()
    {
        if (cam == null)
        {
            Debug.LogError("PlayerShoot: No camera referenced!");
            this.enabled = false;
        }

        weaponManager = GetComponent<WeaponManager>();
    }
 private void Awake()
 {
     man = this;
     Initalize ();
 }
    // Runs before Start
    void Awake()
    {
        // Makes sure that there is only ever one of this script in the game
        if (data == null)
        {
            DontDestroyOnLoad(gameObject);
            data = this;

            // Initialise achievement data
            achievementManager = GetComponent<AchievementManager>();
            achievementManager.Initialise();

            // Load game data from file when starting
            Load();

            // Initialise weapon data
            weaponManager = GetComponent<WeaponManager>();
            weaponManager.Initialise(weaponCount);
        }
        else if (data != this)
        {
            Destroy(gameObject);
        }
    }
 // Use this for initialization
 void Start()
 {
     weaponMng = GameObject.FindGameObjectWithTag("Manager").GetComponent<WeaponManager>();
 }
	void Start()
	{
		controller = GetComponent<CharacterController2D>();
		weaponManager = GetComponentInChildren<WeaponManager>();
	}
Beispiel #53
0
 void Awake()
 {
     rb2d = GetComponent<Rigidbody2D>();
     anim = GetComponent<Animator>();
     weaponManager = GetComponent<WeaponManager>();
 }
 void Start()
 {
     wepManager = FindObjectOfType<WeaponManager>();
 }
Beispiel #55
0
 void Start()
 {
     anim = GetComponentInChildren<Animator>();
     wM = GetComponent<WeaponManager>();
 }
Beispiel #56
0
    protected virtual void Awake()
    {
        // Lifetime
        _lifetime = _DORMANT_LIFESPAN;

        // Weapon manager
        _weaponManager = GameObject.FindGameObjectWithTag ("WeaponManager").GetComponent<WeaponManager>();

        // Layers
        _layEnemy = LayerMask.NameToLayer("Enemy");
        _layIgnoreCollisions = LayerMask.NameToLayer("IgnoreCollisions"); // ignore all collisions
        _layIgnoreEntities = LayerMask.NameToLayer("IgnoreEntities"); // collide with scene but ignore entity collisions (for dormant weapons)
        _layIgnorePlayer = LayerMask.NameToLayer("IgnorePlayer"); // ignore player only, for when thrown and just want to hit enemies and the floor

        // Collider
        _collider = GetComponent<Collider2D>();

        // Find Pickup Trigger
        Transform[] children = GetComponentsInChildren<Transform>();
        foreach(Transform child in children)
        {
            if(child.gameObject.name == "PickupTrigger") _pickupTrigger = child.gameObject;
        }
        if(_pickupTrigger == null) Debug.LogError(name + " has no child called 'PickupTrigger'. Needed to allow player to pick up weapon");

        // Inits
        _rigid = GetComponent<Rigidbody2D>();
        gameObject.layer = _layIgnorePlayer;

        OnAwake();
        Init ();
    }
 // Use this for initialization
 void Start()
 {
     iAMng = GetComponent<EnemyIA>();
     statsSCR = GetComponent<EnemyStats>();
     shipMap = GameObject.FindGameObjectWithTag("Manager").GetComponent<ShipMap>();
     eventsMng = GameObject.FindGameObjectWithTag("Manager").GetComponentInChildren<EventsMainManager>();
     weaponsMng = GameObject.FindGameObjectWithTag("Manager").GetComponent<WeaponManager>();
     weaponsMng.enemy = gameObject;
     StartCoroutine(RepairHullCrt());
     StartCoroutine(InitCrew());
 }
Beispiel #58
0
 void Start()
 {
     agent = GetComponent<NavMeshAgent>();
     charMove = GetComponentInChildren<HumanCharacter>();
     anim = GetComponentInChildren<Animator>();
     weaponManager = GetComponent<WeaponManager>();
     Transform[] wayp = waypointHolder.GetComponentsInChildren<Transform>();
     foreach (Transform tr in wayp)
     {
         if (tr != waypointHolder.transform)
             waypoints.Add(tr);
     }
 }
Beispiel #59
0
    void Start()
    {
        playerActionManager = new ActionManager(this);
        playerWeaponManager = new WeaponManager(this);
        playerHealthManager = new HealthManager(this);

        gameController = GameController.instance;

        Screen.lockCursor = true;

        // if classic mode then each player belongs to a base

        // id of the player which owns this object
        teamID = GetComponent<PhotonView>().owner.ID;

        SetTeamColor();

        if (BaseManager.instance) {
          teamBase = BaseManager.instance.BaseForID(teamID);
        }
    }
Beispiel #60
0
    void Awake()
    {
        _transform = this.transform;
        _mover = GetComponent<Mover>();
        _animation = new EnemyAnimation(GetComponentInChildren<Animator>());
        _myRenderer = GetComponentInChildren<SpriteRenderer>();
        _graphicsTrans = _myRenderer.transform;
        _weaponManager = GameObject.FindGameObjectWithTag("WeaponManager").GetComponent<WeaponManager>();
        _ticketManager = GameObject.FindGameObjectWithTag("TicketManager").GetComponent<TicketManager>();
        myTeam = Team.ENEMY;

        Initialize();
    }