// Update is called once per frame
    void Update()
    {
        isCollision = false;

        resetBoostTime();
        controllerManager();

        myAnim.SetFloat("Speed", Mathf.Abs(myRigidBody.velocity.x));

        if (platformCheck2 == true && (Input.GetKeyDown("v") || BearController.getTransfortmationVar()))
        {
            this.upButton.SetActive(false);
            this.downButton.SetActive(false);
            SoundManager.PlaySound("transformation");
            myAnim.SetBool("vPressed", true);
            tmpPosition    = this.gameObject.transform.position;
            tmpPosition.y += 3;
            this.gameObject.SetActive(false);
            player.transform.position = tmpPosition;
            player.SetActive(true);
            platformCheck2 = false;
        }

        flickerTimeout -= Time.deltaTime;
        GetComponent <Flicker>().animate = flickerTimeout > 0;
        if (flickerTimeout <= 0)
        {
            isFlicker = false;
        }
    }
Esempio n. 2
0
 public void ProcessPawnDeath()
 {
     //StartCoroutine(Sprint(4));
     _wolf = null;
     UpdateAttackTimeOnGameStatusChange();
     _canAttack = true;
 }
Esempio n. 3
0
    public void Hit(RaycastHit castHit)
    {
        GameObject selected = spawnedObjects.Find(x => x.name.Equals(castHit.collider.name));

        if (selected != null)
        {
            Debug.Log("new" + selected + "   " + selected.name);
            BearController controller = selected.GetComponent("BearController") as BearController;
            controller.decreaseHealth();
            ParticleSystem particles = selected.GetComponentInChildren <ParticleSystem>();
            particles.transform.position = castHit.point;
            particles.Play();
            sounds[0].Play();
            if (controller.Health <= 0)
            {
                HUD.GetComponent <HUDManager>().UpdateCurrentNumberOfKills(50);
                sounds[1].Play();
                selected.GetComponent <Animator>().SetTrigger("HasDied");
                selected.GetComponent <UnityEngine.AI.NavMeshAgent>().enabled = false;
                HUD.GetComponent <HUDManager>().UpdateCurrentNumberOfKills(100);
                spawnedObjects.Remove(selected);
                StartCoroutine("Deactivate", selected);
            }
        }
        // throw new NotImplementedException();
    }
    void controllerManager()
    {
        if (Input.GetAxisRaw("Horizontal") > 0f || BearController.getRightButton())
        {
            transform.localScale = new Vector3(3f, 3f, 3f);
            movePlayer();
        }
        else if (Input.GetAxisRaw("Horizontal") < 0f || BearController.getLeftButton())
        {
            transform.localScale = new Vector3(-3f, 3f, 3f);
            movePlayer();
        }
        else if (Input.GetAxisRaw("Vertical") > 0f || goUpB)
        {
            myRigidBody.velocity = new Vector3(myRigidBody.velocity.x, moveSpeed, 0f);
        }
        else if (Input.GetAxis("Vertical") < 0f || goDownB)
        {
            myRigidBody.velocity = new Vector3(myRigidBody.velocity.x, -moveSpeed, 0f);
        }

        if (Input.GetButtonDown("Jump") && !rushing)
        {
            rushing  = true;
            speedMod = 2;
            Instantiate(bubbles, gameObject.transform.position, gameObject.transform.rotation);
            movePlayer();
        }
    }
    void Start()
    {
        GS = GameObject.FindGameObjectWithTag("GameStateManager").GetComponent <GameStates>();
        BC = GameObject.FindGameObjectWithTag("Bear").GetComponent <BearController>();

        print("BearController: " + BC.gameObject.tag);
    }
Esempio n. 6
0
 void Awake()
 {
     input          = InputController.Instance;
     x              = transform;
     y              = x.Find("YHandler");
     mainCam        = y.Find("MainCam").GetComponent <Camera> ();
     bearController = BearController.Instance;
 }
Esempio n. 7
0
 void Awake()
 {
     gameUI         = GameObject.FindGameObjectWithTag(GameplayStatics.GAME_UI_TAG).GetComponent <Canvas>();
     timeText       = gameUI.transform.Find("Timer/Text").GetComponent <Text>();
     animalControl  = GameObject.FindGameObjectWithTag(GameplayStatics.ANIMAL_CONTROL_TAG).GetComponent <AnimalControl>();
     bearController = GameObject.FindGameObjectWithTag("Player").GetComponent <BearController>();
     fireAudio      = this.GetComponent <AudioSource>();
 }
Esempio n. 8
0
 void AttackAnimation()
 {
     _canAttack = false;
     _wolf      = Instantiate(WolfPrefab).GetComponent <BearController>();
     _wolf.OnBattleEnd.AddListener(ProcessPawnDeath);
     _wolf.transform.position = new Vector3(transform.position.x + 2, transform.position.y - 2, 0f);
     OnPawnSpawn.Invoke();
 }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        rbody            = rigidbody2D;
        rbody.fixedAngle = true;

        animator         = GetComponent <BarnAnimation>();
        controller       = GetComponent <BearController>();
        wallGrabCollider = GetComponentInChildren <WallGrabCollider> ();
    }
Esempio n. 10
0
    private void Start()
    {
        bearController = GetComponent <BearController>();
        bossPathing    = GetComponent <BossPathing2>();
        BossMovementStart();

        distanceToBite = biteCollider.bounds.size.x;
        bossPathing.SetOffset(distanceToBite);
        SetAttacks();
    }
Esempio n. 11
0
    // Use this for initialization
    void Start()
    {
        var parent = transform.parent.gameObject;

        rbody            = parent.rigidbody2D;
        rbody.fixedAngle = true;
        controller       = parent.GetComponent <BearController> ();
//		attackInterval = new float[]{0.5f, 1.5f};
        attackbox.enabled = false;
        gameObject.tag    = "Attack";
    }
    public void InitStateMachine(BearController ber)
    {
        base.InitStateMachine();
        startState            = new StartState(this, ber);
        patrolState           = new PatrolState(this, ber);
        travelToPooPlaceState = new TravelToPooPlaceState(this, ber);
        poopGoldState         = new PoopGoldState(this, ber);
        lookConcernedState    = new LookConcernedState(this, ber);
        chaseState            = new ChaseState(this, ber);
        catchState            = new CatchState(this, ber);
        molestState           = new MolestState(this, ber);

        currentState = startState;
        currentState.EnterState();
    }
Esempio n. 13
0
    // Update is called once per frame

    //bool dicks = true;
    void FixedUpdate()
    {
        // Getting Stuff

        GameObject     bearr      = GameObject.Find("Bear Head");
        BearController bearScript = bearr.GetComponent <BearController>();

        pukeCheck = bearScript.puked;

        // Checking for Puke and Counting
        if (pukeCheck)
        {
            counter++;
        }
    }
Esempio n. 14
0
    void Awake()
    {
        bear = GameObject.FindObjectOfType <BearController>();

        CombustionThreshold = MinimumCombustionThreshold + UnityEngine.Random.Range(0, 100);
        ObjCanvas.GetComponent <CanvasGroup>().alpha = 0;
        bIsDestroyed = false;
        foreach (var image in GetComponentInChildren <Canvas>().gameObject.GetComponentsInChildren <Image>())
        {
            if (image.CompareTag(GameplayStatics.LOADING_BAR_TAG))
            {
                RepairBar = image;
                break;
            }
        }
    }
Esempio n. 15
0
    //perform actions on player death
    public override void StartPlayerDieAnimation()
    {
        //if pawn on scene then it should run away
        if (_wolf != null)
        {
            _wolf.RunAway();
            _wolf      = null;
            _canAttack = true;
        }

        //stop boss
        _isInAnimation      = true;
        _startAnimPosition  = transform.position;
        _targetAnimPosition = _targetCharacter.transform.position - new Vector3(1f, 0, 0);
        _animDistance       = (_targetAnimPosition - _startAnimPosition).magnitude;
        StartCoroutine(AnimatePlayerDeath());
    }
 public PoopGoldState(BearStateMachine sm, BearController ber) : base(sm, ber)
 {
 }
Esempio n. 17
0
 // Use this for initialization
 void Start()
 {
     player = gameObject.GetComponentInParent<BearController> ();
 }
Esempio n. 18
0
 // Use this for initialization
 void Start()
 {
     theBearController = GetComponentInParent <BearController> ();
 }
Esempio n. 19
0
    } // UpdatePlayerPosition

    public void SetPushingItem(BearController bear)
    {
        _bearBeingPushed = bear;
    } // SetPushingItem
    } // Start

    public void StartRoad()
    {
        gameObject.SetActive(true);
        _bearOnRoad = GetComponentInChildren <BearController>();
        _bearOnRoad.transform.position = _initialPosition;
    } // StartRoad
 public LookConcernedState(BearStateMachine sm, BearController ber) : base(sm, ber)
 {
 }
 public MolestState(BearStateMachine sm, BearController ber) : base(sm, ber)
 {
 }
Esempio n. 23
0
 void Start()
 {
     player = gameObject.GetComponentInParent <BearController>();
 }
 public BearState(BearStateMachine sm, BearController ber)
 {
     bear = ber;
     bsm  = sm;
 }
 public PatrolState(BearStateMachine sm, BearController ber) : base(sm, ber)
 {
 }
 public TravelToPooPlaceState(BearStateMachine sm, BearController ber) : base(sm, ber)
 {
 }