public virtual void Initialize(MonoBehaviour monoBehaviour)
 {
     _monoBehaviour      = monoBehaviour;
     _shootingController = _monoBehaviour.GetComponent <ShootingController>();
     _healthController   = _monoBehaviour.GetComponent <HealthController>();
     _player             = GameObject.FindGameObjectWithTag("Player");
 }
Example #2
0
    private void Victoria()
    {
        canvasGanas.SetActive(true);


        todosLosEnemigos = GameObject.FindGameObjectsWithTag("Enemigo");
        for (var i = 0; i < todosLosEnemigos.Length; i++)
        {
            if (todosLosEnemigos[i])
            {
                todosLosEnemigos[i].GetComponent <NavigatorMovement>().ParaDePerseguir();
            }
        }
        CharacterController controlador      = this.gameObject.GetComponent <CharacterController>();
        MovementController  scriptMovimiento = this.gameObject.GetComponent <MovementController>();
        ShootingController  scriptDisparo    = this.gameObject.GetComponent <ShootingController>();

        scriptMovimiento.enabled = false;
        controlador.enabled      = false;
        scriptDisparo.enabled    = false;



        Camera.main.transform.position = posicionFinalCamara.position;
        Camera.main.transform.rotation = posicionFinalCamara.rotation;
    }
    public void Destruir(string muerto)
    {
        Instantiate(explosion, transform.position, transform.rotation);

        if (muerto == "Enemigo")
        {
            Destroy(this.gameObject);
        }

        if (muerto == "Player")
        {
            todosLosEnemigos = GameObject.FindGameObjectsWithTag("Enemigo");
            for (var i = 0; i < todosLosEnemigos.Length; i++)
            {
                if (todosLosEnemigos[i])
                {
                    todosLosEnemigos[i].GetComponent <NavigatorMovement>().ParaDePerseguir();
                }
            }
            CharacterController controlador      = this.gameObject.GetComponent <CharacterController>();
            MovementController  scriptMovimiento = this.gameObject.GetComponent <MovementController>();
            ShootingController  scriptDisparo    = this.gameObject.GetComponent <ShootingController>();
            scriptMovimiento.enabled = false;
            controlador.enabled      = false;
            scriptDisparo.enabled    = false;

            canvasFin.SetActive(true);

            var tankRenderer = transform.Find("TankRenderers");
            Destroy(tankRenderer.gameObject);

            Camera.main.transform.position = posicionFinalCamara.position;
            Camera.main.transform.rotation = posicionFinalCamara.rotation;
        }
    }
Example #4
0
    void Awake()
    {
        if (isPlayer)
        {
            _playerController   = GetComponent <CharacterAttackController>();
            _playerMovement     = GetComponent <CharacterMovement>();
            _rigidbody          = GetComponent <Rigidbody>();
            _shootingController = GetComponent <ShootingController>();
        }
        if (isEnemy)
        {
            _enemyController = GetComponent <EnemyController>();
            _navMeshAgent    = GetComponent <NavMeshAgent>();
        }

        if (isViper)
        {
            _navMeshAgent    = GetComponent <NavMeshAgent>();
            _enemyAudio      = GetComponent <AudioSource>();
            _viperController = GetComponent <TheViperController>();
        }



        _animations = GetComponent <CharacterAnimations>();
    }
Example #5
0
    void OnTriggerEnter(Collider other)
    {
        Player3D           player = other.GetComponent <Player3D>();
        ShootingController shoot  = other.GetComponent <ShootingController>();

        if (player != null)
        {
            if (player.bristles == requiredBristleAmount)
            {
                {
                    superBrushActive     = true;
                    mainCamera.enabled   = false;
                    sweepCamera.enabled  = true;
                    camSweepAnim.enabled = true;
                    checkpointUI.SetActive(false);
                    curColorUI.SetActive(false);
                    prevColorUI.SetActive(false);
                    nextColorUI.SetActive(false);
                    bristleUI.SetActive(false);
                    timerUI.SetActive(false);
                    pauseUI.SetActive(false);
                    winUI.SetActive(true);
                    restartButton.SetActive(true);
                    quitButton.SetActive(true);
                    player.playerSpeed = 0f;
                    player.stopJumping = true;
                    shoot.stopShooting = true;
                    player.inkySound.Stop();
                }
            }
        }
    }
    void Awake()
    {
        rb     = gameObject.GetComponent <Rigidbody> ();
        health = gameObject.GetComponent <Health> ();

        shooting         = gameObject.GetComponentInChildren <ShootingController> ();
        rb.interpolation = RigidbodyInterpolation.Extrapolate;
        rb.constraints   = RigidbodyConstraints.FreezeRotation;

        AudioListener listener = GetComponentInChildren <AudioListener> ();

        if (listener != null)
        {
            audioListener          = listener.transform;
            audioListener.parent   = null;                                                                                            //unparent audiolistener
            audioListener.rotation = Quaternion.Euler(0, GameObject.FindObjectOfType <Camera>().transform.rotation.eulerAngles.y, 0); //rotation is based on camera rotation
        }

        timerDisplay.transform.parent = null;         //timer moves independently from player

        health.onDeath += Die;
        health.onHit   += Hit;

        damageOverlay = GameObject.Find("DamageOverlay").GetComponent <Image>();
    }
Example #7
0
    private void Start()
    {
        if (Instance != null)
        {
            Destroy(gameObject);
            return;
        }

        Instance = this;

        if (AsteroidAngle <= 0)
        {
            Debug.LogWarning("Invalid asteroid Angle! (Must be greater than zero!)");
            AsteroidAngle = 60f;
        }

        shootingController = GetComponent <ShootingController>();

        Health = startingHealth;
        Blanks = startingBlanks;

        Score = 0;

        animator = GetComponent <Animator>();

        StartCoroutine(UpdateScore());
    }
Example #8
0
 void Awake()
 {
     this.groundLayer        = LayerMask.GetMask("Ground");
     this.rb                 = GetComponent <Rigidbody2D>();
     this.shootingController = this.GetComponent <ShootingController>();
     this.skeletonAnimation  = this.GetComponentInChildren <SkeletonAnimation>();
     goingRight              = true;
 }
Example #9
0
    void Start()
    {
        movementController = gameObject.AddComponent <MovementController>();
        movementController.Initialize(GetComponentInChildren <IsometricCharacterRenderer>(), GetComponent <Rigidbody2D>(), movementSpeed);       //Get direction from input

        shootingController = gameObject.AddComponent <ShootingController>();
        shootingController.Initialize(GetComponentInChildren <IsometricCharacterRenderer>(), ShootingProjectiles[0]);
    }
Example #10
0
 void Awake()
 {
     playerInput        = GetComponent <PlayerInput>();
     movementController = GetComponent <MovementController>();
     shootingController = GetComponent <ShootingController>();
     dashTime           = properties.dashTime;
     LifePoints         = properties.lifePoints;
 }
Example #11
0
 private void Awake()
 {
     Instance             = transform;
     m_rigidbody          = GetComponent <Rigidbody>();
     m_pitchYawRoll       = transform.localEulerAngles;
     m_health             = GetComponent <HealthSystem>();
     m_shootingController = GetComponent <ShootingController>();
 }
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.layer == 9)
     {
         ShootingController gunController = other.gameObject.GetComponent <ShootingController>();
         gunController.PickupWeapon(weaponIndex);
         Destroy(gameObject);
     }
 }
    protected override void Init()
    {
        shooting = gameObject.GetComponentInChildren <ShootingController> ();
        pc       = GameObject.FindObjectOfType <PlayerController> ();

        base.Init();

        backsUp = moves;
        GameManager.allEnemyTargets.Add(transform);
    }
Example #14
0
    void Start()
    {
        heli     = GetComponent <Helicopter> ();
        player   = GameObject.FindObjectOfType <PlayerController> ().transform;
        shooting = GetComponentInChildren <ShootingController> ();

        UpdateTargetsQue();

        AIStart();
    }
Example #15
0
    public void SaveGame()
    {
        ShootingController controller = GetComponent <ShootingController>();

        PlayerPrefs.SetInt(Key.LastScore, score);
        PlayerPrefs.SetInt(Key.BallAmount, controller.Amount);
        PlayerPrefs.SetString(Key.LastBall, controller.BallName);
        bm.SaveBlocks();
        PlayerPrefs.SetInt(Key.GameIsSaved, 1);
        PlayerPrefs.Save();
    }
Example #16
0
 public void Start()
 {
     if (!shootingController)
     {
         shootingController = GameObject.Find("ShootingController").GetComponent <ShootingController>();
     }
     if (!gameController)
     {
         gameController = GameObject.Find("GameController").GetComponent <GameController> ();
     }
 }
    void Start()
    {
        shooting = GetComponentInChildren <ShootingController> ();
        shooting.SetEnabled(false);

        if (automatic)
        {
            SetupTarget();
        }

        obstacle         = GetComponent <NavMeshObstacle> ();
        obstacle.enabled = false;
    }
    //EffectFollow currentVisualEffect;

    protected override void Init()
    {
        shooting = gameObject.GetComponentInChildren <ShootingController> ();

        prioritizesFirstTarget = true;

        base.Init();

        backsUp             = moves;
        originalActiveRange = activeRange;
        health.onHit        = TriggerAlert;
        health.onSwipeDeath = TrySwapWeapons;
    }
Example #19
0
 //.5s invulnerability when hit?
 // Start is called before the first frame update
 void Awake()
 {
     playerController   = GetComponent <PlayerController>();
     shootingController = GetComponentInChildren <ShootingController>();
     Time.timeScale     = 1;//unpause
     hpCanvas           = Instantiate(hpCanvas);
     deathCanvas        = Instantiate(deathCanvas);
     deathCanvas.gameObject.SetActive(false);
     //This is a mess but it works for now
     hpText = hpCanvas.gameObject.transform.GetChild(1).GetComponent <TextMeshProUGUI>();
     alive  = true;
     tag    = playerTag;
 }
Example #20
0
    void Start()
    {
        if (GameObject.Find("BGM") != null)
        {
            bgm = GameObject.Find("BGM");
            mp  = bgm.GetComponent <MusicPlayer>();
        }


        if (pref != null)
        {
            pb = pref.GetComponent <ShootingController>();
        }
    }
Example #21
0
    // Use this for initialization
    public override void Start()
    {
        sceneController = (ShootingController)SSDirector.Instance.currentSceneController;
        var d = Camera.main.ScreenPointToRay(Input.mousePosition).direction;

        gameobject.SetActive(true);
        sceneController.head.SetActive(true);
        transform.position = new Vector3(d.x, d.y + 1, 0);
        transform.rotation = Quaternion.Euler(90, 0, 0);
        var rig = gameobject.GetComponent <Rigidbody>() as Rigidbody;

        rig.isKinematic = false;
        rig.velocity    = Vector3.zero;
        rig.AddForce(d * 30, ForceMode.Impulse);
        rig.AddForce(sceneController.wind, ForceMode.Impulse);
    }
    void Start()
    {
        if (GetComponent <ChopperAI> () != null)
        {
            hasAI = true;
            ai    = GetComponent <ChopperAI> ();
        }

        shooting = GetComponentInChildren <ShootingController> ();

        // setup check points
        for (int i = 0; i < groundCheckPointsContainer.childCount; i++)
        {
            checkPoints.Add(groundCheckPointsContainer.GetChild(i));
        }
    }
    public string colorType; //Stores color type for each paint pickup

    void Start()
    {
        // GameObject coloring = GameObject.FindGameObjectWithTag("Swap");

        // if (coloring != null)
        // {
        //     colorSwap = coloring.GetComponent<InkyColorChange>();
        // }

        //Get and find projectile color manager
        GameObject proj = GameObject.FindGameObjectWithTag("Player");

        if (proj != null)
        {
            playerShooting = proj.GetComponent <ShootingController>();
        }
    }
Example #24
0
	public void InitEvents ()
	{
		fc = FlowControl.Instance;
		lc = LevelControl.Instance;
		sc = ScoreControl.Instance;
		uic = UIControl.Instance;
		dc = DataControl.Instance;
		shootC = GameObject.Find ("Player").GetComponent<ShootingController> ();

		lc.BallsChanged += OnBallsChanged;
		lc.LevelChanged += OnLevelChanged;
		lc.TargetsChanged += OnTargetsChanged;
		sc.ScoreChanged += OnScoreChanged;
		shootC.InitPowerSlider += OnInitPowerSlider;
		shootC.UpdatePowerSlider += OnUpdatePowerSlider;

		string levelKind = dc.GetLevel (fc.Level).Kind;
		if (levelKind.Equals ("T"))
			GameObject.Find ("Player").GetComponent<MoveOnTrails> ().TrailsEndReached += OnTrailsEndReached;
	}
Example #25
0
    // Start is called before the first frame update
    void Start()
    {
        canTime = true;

        //Find and get player
        GameObject inky = GameObject.FindGameObjectWithTag("Player");

        if (inky != null)
        {
            player = inky.GetComponent <Player3D>();
        }

        //Find and get player's shooting ability
        GameObject shooting = GameObject.FindGameObjectWithTag("Player");

        if (shooting != null)
        {
            shoot = shooting.GetComponent <ShootingController>();
        }
    }
    //called at intialisation
    void Start()
    {
        //gets the button listener
        buttonListen = (GameObject.FindGameObjectWithTag("GameController")).GetComponent <ButtonListener> ();

        //sets the movedirection to zero
        moveDirection = Vector2.zero;

        //gets the physics controller
        controller = GetComponent <Rigidbody2D>();

        //gets the animator
        animator = GetComponent <Animator> ();

        //sets health and healthbar
        health    = StartingHealth;
        healthBar = GameObject.FindGameObjectWithTag("HealthBar");
        healthBar.GetComponent <Slider> ().value = health;

        //sets ammo and ammo count
        //addAmmoCount(StartingRangeAmmo);
        //RangeAmmoCountBox = GameObject.FindGameObjectWithTag ("AmmoCount");

        //gets objects for shooting
        shootCon   = GetComponent <ShootingController>();
        lineRender = trajectoryObject.GetComponent <LineRenderer>();

        //closes line renderer
        lineRender.gameObject.SetActive(false);

        //sets defualt of active
        //if (activeCount == null)
        //    activeCount = PrimaryAmmoCount;
        if (PrimarySelected)
        {
            setActiveAmmoPrimary(true);
        }

        //gets sound object
        ASound = GetComponent <AttackSoundEffect>();
    }
Example #27
0
    private IEnumerator StartPowerupTask()
    {
        ShootingController sController = Player.Instance.shootingController;
        ShootingSpeed      original    = sController.ShootSpeed;

        sController.DelayBetweenShots = ShootingSpeed.FASTEST.Speed;

        float t = 10;

        while (t > 0)
        {
            t -= Time.deltaTime;
            yield return(null);
        }

        sController.DelayBetweenShots = original.Speed;

        if (gameObject)
        {
            Destroy(gameObject);
        }
    }
    void Start()
    {
        TrialActive = -1;

        IsGoaled    = false;
        IsTimedOut  = false;
        ElapsedTime = 0f;

        CurrentMaxFitness = 0f;
        FitnessList       = new List <float>(Positions.Length);

        OptimizationManager = Optimizer.GetComponent <OptimizationManager>();
        PositionCounter     = 0;

        GoalScorer = Goal.GetComponent <GoalScorerController>();

        Robot = (GameObject)Instantiate(Resources.Load("ShootingCar"), new Vector3(0f, 3f, 15f), Quaternion.identity);
        ShootingController = Robot.GetComponent <ShootingController>();
        ShootingController.Initialize(Ball, Goal);

        RobotRigidbody = Robot.GetComponent <Rigidbody>();
        BallRigidbody  = Ball.GetComponent <Rigidbody>();
    }
Example #29
0
    void Start()
    {
        playerRB    = GetComponent <Rigidbody>();
        playerCol   = GetComponent <BoxCollider>();
        playerRend  = GetComponent <Renderer>();
        playerShoot = GetComponent <ShootingController>();
        inky        = GetComponent <Animator>();

        playerRend.material = inkyMaterials[0];   //Sets player's starting material to Greyscale
        currentCheckpoint   = transform.position; //Sets player's first checkpoint to player location on start up
        canDestroyFloor     = false;

        cpText.enabled = false; //Do not display checkpoint text until the player reaches it

        alterMovement = false;
        stickyHor     = false;
        stopJumping   = false;

        nextColor.color = uiColors[1]; //Display the default next color from the predetermined color order until the player switches color
        prevColor.color = uiColors[3]; //Display the default previous color from the predetermined color order until the player switches color


        onRamp = false;
    }
    // Use this for initialization
    void Awake()
    {
        //closes overlay
        overlay.SetActive(false);

        //sets target to player
        target       = GameObject.FindGameObjectWithTag("Player").transform;
        playerHitBox = GameObject.FindGameObjectWithTag("Player").GetComponent <ControllerPlayer> ().hitBox;

        //sets instance nav agent
        nav = GetComponent <NavigateAgent> ();

        //gets the path follower
        follow = GetComponent <PathFollower> ();

        //gets animator of instance
        animator = GetComponent <Animator> ();

        //gets rigidbody
        controller = GetComponent <Rigidbody2D> ();

        //gets shooting controller
        shootCon = GetComponent <ShootingController>();

        //sets health and death state
        health  = StartingHealth;
        onDeath = false;

        if (rangeAngle == Vector2.zero)
        {
            rangeAngle = new Vector2(1f, 1f);
        }

        //gets sound
        ASound = GetComponent <AttackSoundEffect>();
    }
Example #31
0
 // Use this for initialization
 void Start()
 {
     sceneController = SSDirector.Instance.currentSceneController as ShootingController;
 }
 // Use this for initialization
 void Start()
 {
     shooting = gunEnd.GetComponent <ShootingController>();
     player = GameObject.FindWithTag("Player");
     random = new System.Random ();
 }