Exemplo n.º 1
0
 public override void DisposeNode()
 {
     gunControl = null;
     gun        = null;
     pos        = null;
     display    = null;
 }
Exemplo n.º 2
0
 public override void SetUp()
 {
     gunControl = new GunControl(Keys.Space);
     gun        = new Gun(0, 0);
     pos        = new Position();
     display    = new Display();
 }
Exemplo n.º 3
0
    // Use this for initialization
    private void Awake()
    {
        lastMove.y = -1;
        isSpotted  = false;

        myRigidbody   = GetComponent <Rigidbody2D>();
        anim          = GetComponent <Animator>();
        myAudioSource = GetComponent <AudioSource>();
        myRenderer    = GetComponent <Renderer>();

        equip     = 0;
        gun       = transform.Find("Gun").gameObject.GetComponent <GunControl>();
        crosshair = transform.Find("Crosshair").gameObject;

        soundManager = GameObject.Find("Sound Manager").GetComponent <SoundManager>();

        bowData = new BowData();

        moveSpeed = defaultSpeed;

        health = maxHealth;

        searchableArea = transform.Find("Searchable Area").GetComponent <PlayerSearchableArea>();

        flashlight = transform.Find("Flashlight").gameObject;
    }
Exemplo n.º 4
0
 private void Awake()
 {
     GameManager.Instance.OnPlayerSpawn += (player) => {
         control = player.GetComponent <GunControl>();
         Assert.AreEqual(modeIconBackground.Length, control.GunCount);
         init = true;
     };
 }
Exemplo n.º 5
0
 void OnGame()
 {
     if (GunControl.IsFireInput())
     {
         if (gun.FireGun())
         {
             fired = true;
         }
     }
 }
Exemplo n.º 6
0
 void Start()
 {
     _checkfire = true;
     _tenlua    = false;
     Instance   = this;
     _ani       = GetComponent <Animator>();
     _ani.Play("Idle", 0, 0);
     _ani.SetFloat("level", 0);
     _ani.speed = 2;
     _levelGun  = 1;
     BonusCoin  = 1;
 }
Exemplo n.º 7
0
    void Start()
    {
        scriptplayer = GameObject.FindWithTag("Player").GetComponent <PlayerControl>();
        scriptGun    = GameObject.FindObjectOfType(typeof(GunControl)) as GunControl;

        SliderHP.maxValue = scriptplayer.status.health;
        SliderHP.minValue = 0;
        Time.timeScale    = 1;
        timeRecord        = PlayerPrefs.GetFloat("TimeRecord");

        textQtdBalas.text = string.Format("x {0}", scriptGun.currentAmmo);
    }
Exemplo n.º 8
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         GunControl scriptgun = other.GetComponent <GunControl>();
         if (scriptgun.currentAmmo < scriptgun.totalAmmo)
         {
             scriptgun.Recarregar(ammo);
             Destroy(gameObject);
             ammoBoxScript.DiminuirQtdMunicoes();
         }
     }
 }
Exemplo n.º 9
0
    void interact()
    {
        if (Input.GetKeyDown("f"))
        {
            RaycastHit target;
            if (Physics.Raycast(FPSCamera.transform.position, FPSCamera.transform.forward, out target, range))
            {
                Debug.Log(target.transform.name);

                if (target.transform.tag == "Gun")
                {
                    if (FPSCamera.transform.childCount > 0)
                    {
                        FPSCamera.transform.GetChild(0).GetComponent <GunControl>().unequip();
                    }

                    GunControl gunControl = target.transform.GetComponent <GunControl>();
                    gunControl.Selected(FPSCamera.transform);
                }
            }
        }
    }
Exemplo n.º 10
0
    bool UpdateAttacker(Paratrooper attacker)
    {
        // This is a superhack. I know.

        float x = Mathf.Abs(attacker.transform.position.x);
        float y = attacker.transform.position.y;

        if (x < 1.6f)
        {
            // Attacker has hit the turret
            GunControl gun = GameObject.Find("Gun").GetComponent <GunControl>();
            gun.ExplodeAndDie();
            attacker.gameObject.GetComponent <Rigidbody2D>().gravityScale = 5;
            attacker.gameObject.GetComponent <Rigidbody2D>().drag         = 0;
            attacker.gameObject.GetComponent <Rigidbody2D>().fixedAngle   = false;
            attacker.gameObject.GetComponent <Rigidbody2D>().AddForce(new Vector3(-attacker.move.x * 30, 30), ForceMode2D.Impulse);
            attacker.gameObject.GetComponent <Rigidbody2D>().AddTorque(200 * attacker.move.x);
            attacker.move.x = 0;
            return(false);
        }
        else if (x >= 4.6f && y < 0.1f)
        {
            // Move towards turret on ground
            attacker.gameObject.GetComponent <Rigidbody2D>().gravityScale = 0;
            MoveAttacker(attacker, attacker.move.x, 0);
        }
        else if (x < 4.6f && y <= 6)
        {
            // Move up next to turret
            attacker.gameObject.GetComponent <Rigidbody2D>().gravityScale = 0;
            MoveAttacker(attacker, 0, 1);
        }
        else if (y > 6)
        {
            // Move towards turret on the turret
            MoveAttacker(attacker, attacker.move.x, 0);
        }
        return(true);
    }
Exemplo n.º 11
0
    // ******************************

    private void BuildGame()
    {
        // Area
        _area = FindObjectOfType <Area>();

        // Async
        _async = gameObject.AddComponent <Async>();

        // Effects
        _effects = gameObject.AddComponent <Effects>();

        // Area Controller
        _areaController = gameObject.AddComponent <AreaController>();

        // UIController
        _uiController = gameObject.AddComponent <UIController>();

        // Gun Control
        _gunControl = gameObject.AddComponent <GunControl>();

        // Input
        _input = gameObject.AddComponent <InputStack>();
    }
Exemplo n.º 12
0
 public override void SetComponent(Component comp)
 {
     if (comp.ClassId == pos.ClassId)
     {
         pos = (Position)comp;
     }
     else if (comp.ClassId == gun.ClassId)
     {
         gun = (Gun)comp;
     }
     else if (comp.ClassId == gunControl.ClassId)
     {
         gunControl = (GunControl)comp;
     }
     else if (comp.ClassId == display.ClassId)
     {
         display = (Display)comp;
     }
     else
     {
         throw new Exception("You passed a wrong component to the " + GetType().Name + " class");
     }
 }
Exemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     gunControl = transform.GetComponent <GunControl>();
     gunControl.SetGunType(gunName, pistolHipLoc, pistolAimLoc, pistolDamage, pistolFireRate, pistolReloadTime, pistolAccuracy, isSelectiveFire, -1, pistolCapacity);
 }
Exemplo n.º 14
0
    // Update is called once per frame
    void Update()
    {
        if (state != State.Idle)
        {
            this.timer += Time.deltaTime;
        }

        switch (state)
        {
        case State.Idle:
            SetPositions(0);
            if (GunControl.IsFireInput())
            {
                SetState(State.Ready);
                Play(Ready);
                NewGame();
            }
            break;

        case State.Ready:
            SetPositions(timer);
            if (timer > 1)
            {
                SetState(State.Game);
                Play(Begin);
            }
            break;

        case State.Game:
            SetPositions(1);
            OnGame();
            if (timer > 15)
            {
                SetState(State.Game3);
                Play(Three);
            }
            break;

        case State.Game3:
            SetPositions(1);
            OnGame();
            if (timer > 1)
            {
                SetState(State.Game2);
                Play(Two);
            }
            break;

        case State.Game2:
            SetPositions(1);
            OnGame();
            if (timer > 1)
            {
                SetState(State.Win);
                Play(One);
            }
            break;

        case State.Win:
            SetPositions(1 - timer);
            if (timer > 1)
            {
                SetState(State.Score);
                Play(Win);
            }
            break;

        case State.Score:
            SetPositions(0);
            if (timer > 1)
            {
                SetState(State.Idle);
                Play(Flawless);
            }
            break;
        }
    }
Exemplo n.º 15
0
 public void targetedByGun(GunControl gun)
 {
     targetedBy.Add(gun);
 }
Exemplo n.º 16
0
 void Awake()
 {
     _instance = this;
 }
Exemplo n.º 17
0
 void Activate()
 {
     birdGenerator = transform.root.GetComponent <BirdGenerator>();
     gun           = GameObject.FindWithTag("Gun").GetComponent <GunControl>();
     activated     = true;
 }
	void Start()
	{
		_anim = gameObject.GetComponent<Animator>() as Animator;
		_gunControl = GetComponent<GunControl> ();
		//_AnimCamera = aimCamera.GetComponent<Animator>() as Animator;
	}
Exemplo n.º 19
0
 // Start is called before the first frame update
 void Start()
 {
     switchGunScript = gameObject.GetComponent <GunControl>();
 }
Exemplo n.º 20
0
 // Start is called before the first frame update
 void Start()
 {
     gunControl = transform.GetComponent <GunControl>();
     gunControl.SetGunType(gunName, AKHipLoc, AKAimLoc, AKDamage, AKFireRate, AKReloadTime, AKAccuracy, isSelectiveFire, 1, AKCapacity);
 }
Exemplo n.º 21
0
 private void Start()
 {
     rb      = GetComponent <Rigidbody2D>();
     col     = GetComponent <Collider2D>();
     gunCtrl = GetComponent <GunControl>();
 }