Beispiel #1
0
 // Update is called once per frame
 void Awake()
 {
     rb2d          = GetComponent <Rigidbody2D>();
     gm            = GameObject.Find("GameManager").GetComponent <GameManager>();
     PlayerManager = GameObject.Find("PlayerManager");
     PM            = (Player_Manager)PlayerManager.GetComponent(typeof(Player_Manager));
 }
    void OnTriggerExit2D(Collider2D coll)
    {
        // Attempt to grab the Player_Manager script
        Player_Manager _player = coll.GetComponent <Player_Manager>();

        // IF the colliding object doesnt have the Player Manager script.
        if (_player == null)
        {
            return;
        }
        // IF the colliding object's tag isn't Player.
        if (coll.tag != "Player")
        {
            return;
        }
        // We remove this script from our player state list.
        _playerManager.playerState.ListOfActionKeyDialogues.Remove(this);
        // IF the dialogue component isn't null.
        if (dialogueComponent != null)
        {
            // Stop all the coroutines in the dialogueComponent.
            dialogueComponent.StopAllCoroutines();
            // Stop all coroutines on this script.
            StopAllCoroutines();
            // Finish off all actions while exiting the collider.
            StartCoroutine(ExitCollider());
        }
    }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     InvaderManager = GameObject.Find("InvaderManager");
     IM             = (Invader_Manager)InvaderManager.GetComponent(typeof(Invader_Manager));
     PlayerManager  = GameObject.Find("PlayerManager");
     PM             = (Player_Manager)PlayerManager.GetComponent(typeof(Player_Manager));
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        //Can start combat
        if (collision.tag == "player_combat_collider")
        {
            if (currentAction != null)
            {
                currentAction.isFinish = true;
            }

            can_start_combat = true;
        }

        if (collision.tag == "player_change_state_collider")
        {
            Player_Manager pm = collision.GetComponentInParent <Player_Manager>();
            if (pm != null && pm.current_state == Player_Manager.Player_States.DASHING_PLAYER &&
                currentAction != stunned && !(bool)myBB.GetParameter("is_enemy_stunned"))
            {
                if (currentAction != null)
                {
                    currentAction.isFinish = true;
                }

                myBB.SetParameter("is_enemy_stunned", true);
            }
        }
    }
Beispiel #5
0
    private GameObject target;  // USED TO SET THE TARGET FOR THR ENEMY

    private void Start()
    {
        gm     = GameObject.Find("Game_Manager").GetComponent <Game_Manager>();              // USED TIO FIND THE GAME MANAGER AND ACCESS THE GAMEMANAGER SCRIPT
        plM    = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Manager>(); // USED TIO FIND THE PLAYER GAMEOBJECT AND ACCESS THE PLAYERMANAGER SCRIPT
        target = GameObject.FindGameObjectWithTag("Player");                                 // SETS THE TARGET TO THE GAMEOBJECT WITH THE TAG PLAYER
        speed  = 3;                                                                          // SETS THE SPEED OF THE ENEMY AI TO 3
    }
Beispiel #6
0
    // Use this for initialization
    void Start()
    {
        PlayerManager       = GameObject.Find("SmallHuman_001");
        playerManagerScript = PlayerManager.GetComponent <Player_Manager>();

        Club_Driver = GameObject.Find("GolfClub_Driver_elbow");
        Club_Iron   = GameObject.Find("GolfClub_Iron_elbow");
        Club_Putter = GameObject.Find("GolfClub_Putter_elbow");

        Weapon_Driver = GameObject.Find("Weapon_Driver_elbow");
        Weapon_Iron   = GameObject.Find("Weapon_Iron_elbow");
        Weapon_Putter = GameObject.Find("Weapon_Putter_elbow");

        UnusedClubs.Add(Club_Iron);
        UnusedClubs.Add(Club_Putter);
        Club_Iron.SetActive(false);
        Club_Putter.SetActive(false);

        UnusedWeapons.Add(Weapon_Iron);
        UnusedWeapons.Add(Weapon_Putter);
        Weapon_Driver.SetActive(false);
        Weapon_Iron.SetActive(false);
        Weapon_Putter.SetActive(false);

        currentClub   = Club_Driver;
        currentWeapon = Weapon_Driver;

        currentBulletState = BulletStates.DriverBullet;
    }
Beispiel #7
0
 void Start()
 {
     //Get play component
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Manager>();
     //Get the fader
     fader = FindObjectOfType <Fader>();
 }
Beispiel #8
0
    void Awake()
    {
        anim           = GetComponent <Animator> ();
        invaderType    = anim.runtimeAnimatorController.name.ToString();
        rb2d           = GetComponent <Rigidbody2D> ();
        gm             = GameObject.Find("GameManager").GetComponent <GameManager>();
        InvaderManager = GameObject.Find("InvaderManager");
        IM             = (Invader_Manager)InvaderManager.GetComponent(typeof(Invader_Manager));
        PlayerManager  = GameObject.Find("PlayerManager");
        PM             = (Player_Manager)PlayerManager.GetComponent(typeof(Player_Manager));
        LevelManager   = GameObject.Find("LevelManager");
        LM             = (Level_Manager)LevelManager.GetComponent(typeof(Level_Manager));
        InvaderGrid    = GameObject.FindGameObjectWithTag("InvaderGrid");
        IG             = (InvaderGrid)InvaderGrid.GetComponent(typeof(InvaderGrid));
        PolygonCollider2D playerCollider = GetComponent <PolygonCollider2D>();

        invaderRadius = playerCollider.bounds.extents.x;
        float   camDistance  = Vector3.Distance(transform.position, Camera.main.transform.position);
        Vector2 bottomCorner = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, camDistance));
        Vector2 topCorner    = Camera.main.ViewportToWorldPoint(new Vector3(1, 1, camDistance));

        randomNumber       = Random.Range(0, IM.explosions.Length);
        IM.currentInvaders = GameObject.FindGameObjectsWithTag("Invaders").Length;
        minX             = bottomCorner.x + invaderRadius;
        maxX             = topCorner.x - invaderRadius;
        minY             = bottomCorner.y + invaderRadius;
        maxY             = topCorner.y - invaderRadius;
        IG.invaderDir    = "Right";
        invaderDirection = "Right";
    }
Beispiel #9
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Beispiel #10
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        // Attempt to grab the Player_Manager script
        Player_Manager _player = coll.GetComponent <Player_Manager>();

        // IF the colliding object doesnt have the Player Manager script.
        if (_player == null)
        {
            return;
        }
        // IF the colliding object's tag isn't Player.
        if (coll.tag != "Player")
        {
            return;
        }
        // We are inside.
        isInside = true;
        // Assign the Player Manager script.
        _playerManager = _player;
        // Since we have a Player Manager script we assign the state.
        _playerManager.playerState.ListOfAreaDialogues.Add(this);
        // IF we do not have a null closest Action Key Dialogue component AND the Action Key Dialogue variable 'destroyAreaDialogue' is set to 'true'.
        if (_playerManager.playerState.ClosestAKD != null && _playerManager.playerState.ClosestAKD.destroyAreaDialogues)
        {
            // Do nothing.
        }
        else
        {
            // We begin the dialogue.
            CreateDialogue();
        }
    }
Beispiel #11
0
 void SetInitialReferences()
 {
     if (GameManager_References.player != null)
     {
         playerMaster = GameManager_References.player.GetComponent <Player_Manager>();
     }
 }
Beispiel #12
0
    override public BT_Status StartAction()
    {
        player = (GameObject)myBT.myBB.GetParameter("player");
        if (player == null)
        {
            Debug.Log("<color=red> Player not found!_Action_FollowPlayer");
        }

        myAnimator = (Animator)myBT.myBB.GetParameter("myAnimator");

        if (myAnimator)
        {
            myAnimator.SetInteger("Phase", 1);
            myAnimator.SetBool("enemy_startwalking", false);
            myAnimator.SetBool("Shoot", false);
        }

        rayTrans = rayGO.transform;
        rayCol   = rayGO.GetComponentInChildren <BoxCollider2D>();
        raySpr   = rayGO.GetComponentInChildren <SpriteRenderer>();

        skeletonCol   = skeletontObj.GetComponent <CircleCollider2D>();
        managerPlayer = player.GetComponent <Player_Manager>();

        rayGO.SetActive(true);
        rayCol.enabled = false;
        raySpr.color   = new Color(raySpr.color.r, raySpr.color.g, raySpr.color.b, 0.3294118f);
        rayDetect      = rayGO.GetComponentInChildren <PlayerDetection_Damage>();

        sheletonsInstancied = new Transform[numSkeletons];

        actionCoroutine = StartCoroutine(RayShoot());

        return(BT_Status.RUNNING);
    }
Beispiel #13
0
    void OnTriggerExit2D(Collider2D coll)
    {
        // Attempt to grab the Player_Manager script
        Player_Manager _player = coll.GetComponent <Player_Manager>();

        // IF the colliding object doesnt have the Player Manager script.
        if (_player == null)
        {
            return;
        }
        // IF the colliding object's tag isn't Player.
        if (coll.tag != "Player")
        {
            return;
        }
        // We are no longer inside.
        isInside = false;
        // Since the dialogue is being destroyed we assign the state.
        _playerManager.playerState.ListOfAreaDialogues.Remove(this);
        // Reset the dialogueIndex.
        dialogueIndex = 0;
        if (dialogueComponent != null)
        {
            dialogueComponent.StopAllCoroutines();
        }
        // IF the dialogue is activatable.
        if (isActivatable)
        {
            // Stop the coroutines for resetting the dialogue.
            StopAllCoroutines();
            // We need to create some time before the NPC talks again.
            StartCoroutine(InteractiveDowntime());
        }
    }
Beispiel #14
0
 protected void OnDestroy()
 {
     if (singleton == this)
     {
         singleton = null;
     }
 }
Beispiel #15
0
    // Use this for initialization
    void Start()
    {
        PlayerManager       = GameObject.Find("SmallHuman_001");
        playerManagerScript = PlayerManager.GetComponent <Player_Manager>();

        GolfBallCamera  = GameObject.Find("GolfBallTempCamera");
        OverWorldCamera = GameObject.Find("OverWorldCamera");
        GolfBallCamera2 = GameObject.Find("GolfBallLanding_Camera");

        GolfBallCamera.SetActive(false);
        OverWorldCamera.SetActive(false);
        GolfBallCamera2.SetActive(false);

        actualPlayer   = GameObject.Find("SmallHuman_001");
        actualGolfBall = GameObject.Find("GolfBall_Temp");

        GolfClubFOV = 120.0f;
        WeaponFOV   = 100.0f;
        VanillaFOV  = 60.0f;
        currentFOV  = GetComponent <Camera>().fieldOfView;

        VanillaCameraFollow = GameObject.Find("VanillaCameraFollow");
        GolfingCameraFollow = GameObject.Find("GolfingCameraFollow");
        WeaponCameraFollow  = GameObject.Find("WeaponCameraFollow");

        horAndVertCameraMoving = false;
        horAndVertCameraMoved  = false;
    }
Beispiel #16
0
    public bool CanMove(int ActionPoint, int[] Prev,int cost)
    {
        Tile_Manager.Cover_Kind Kind;
        Kind = _Tile.TileMap[X][Y];

        if (Kind == Tile_Manager.Cover_Kind.HighCover || StartPoint)
            return false;

        if (RealCost != -1 && RealCost <= cost) return false;

        if (Kind == Tile_Manager.Cover_Kind.HalfCover) {
            cost++;
            ActionPoint--;
        }
        if (ActionPoint - Action.Now_Move_Point < 0)
        {
            if (!Check)
                Action = null;

            return false;
        }

        ActionPoint -= Action.Now_Move_Point;
        cost += Action.Now_Move_Point;

        RealCost = cost;
        if (!Check)
        {
            GetComponent<SpriteRenderer>().color -= new Color(0.3f, 0.3f, 0.3f, -1);
            Prev_Highlighted = GetComponent<SpriteRenderer>().color;

            if (_obstacle != null)
                _obstacle.Change();
        }

        Check = true;
        if (X - 1 >= 0 && X - 1 != Prev[0])
        {
            _Tile.MY_Tile[X - 1][Y].Action = Action;
            _Tile.MY_Tile[X - 1][Y].CanMove(ActionPoint, new int[] { X, Y },cost);
        }
        if (X + 1 < _Tile.X && X + 1 != Prev[0])
        {
            _Tile.MY_Tile[X + 1][Y].Action = Action;
            _Tile.MY_Tile[X + 1][Y].CanMove(ActionPoint, new int[] { X, Y }, cost);
        }
        if (Y - 1 >= 0 && Y - 1 != Prev[1])
        {
            _Tile.MY_Tile[X][Y - 1].Action = Action;
            _Tile.MY_Tile[X][Y - 1].CanMove(ActionPoint, new int[] { X, Y },cost);
        }
        if (Y + 1 < _Tile.Y && Y + 1 != Prev[1])
        {
            _Tile.MY_Tile[X][Y + 1].Action = Action;
            _Tile.MY_Tile[X][Y + 1].CanMove(ActionPoint, new int[] { X, Y }, cost);
        }

        return true;
    }
Beispiel #17
0
 // Use this for initialization
 void Start()
 {
     playerCamera  = GameObject.Find(transform.parent.name + "/Camera");
     camRotation   = playerCamera.GetComponent <Cam_Rotation>();
     gamePad       = transform.parent.gameObject.GetComponent <GamePad_Manager>();
     playerManager = transform.parent.GetComponent <Player_Manager>();
     rb            = GetComponent <Rigidbody>();
 }
Beispiel #18
0
    // Use this for initialization
    void Start()
    {
        PlayerManager       = GameObject.Find("SmallHuman_001");
        playerManagerScript = PlayerManager.GetComponent <Player_Manager>();

        //GetComponent<Renderer>().enabled = false;
        //GetComponent<Collider>().enabled = false;
    }
Beispiel #19
0
    // Use this for initialization
    void Start()
    {
        actualPlayer = GameObject.Find("SmallHuman_001");
        GetComponent <Behaviour>().enabled = false;

        PlayerManager       = GameObject.Find("SmallHuman_001");
        playerManagerScript = PlayerManager.GetComponent <Player_Manager>();
    }
Beispiel #20
0
 void Awake()
 {
     // Get the Player State.
     _playerManager = GetComponent <Player_Manager>();
     // Get the Rigidbody2D Component.
     rb = GetComponent <Rigidbody2D>();
     // Check for mistakes.
     DebugCheck();
 }
Beispiel #21
0
 void Awake()
 {
     InvaderManager = GameObject.Find("InvaderManager");
     LevelManager   = GameObject.Find("LevelManager");
     PlayerManager  = GameObject.Find("PlayerManager");
     PM             = (Player_Manager)PlayerManager.GetComponent(typeof(Player_Manager));
     LM             = (Level_Manager)LevelManager.GetComponent(typeof(Level_Manager));
     IM             = (Invader_Manager)InvaderManager.GetComponent(typeof(Invader_Manager));
 }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("player_movement_collider"))
     {
         Player_Manager PlayerManager = ProceduralDungeonGenerator.mapGenerator.Player.GetComponent <Player_Manager>();
         PlayerManager.WriteInJSON();
         SceneManager.LoadScene(scene, LoadSceneMode.Single);
     }
 }
    // Use this for initialization
    void Start()
    {
        PlayerManager       = GameObject.Find("SmallHuman_001");
        playerManagerScript = PlayerManager.GetComponent <Player_Manager>();

        originalRotationValue = transform.rotation;

        actualGolfBall = GameObject.Find("GolfBall_Temp");
    }
Beispiel #24
0
    private void Start()
    {
        Player_Inventory_Objects = new Object_InGame[8];

        playerManager = GetComponent <Player_Manager>();

        //Pushback to all objects of the game

        //Right_Hand_Object = All_Game_Objects[0];
    }
Beispiel #25
0
    // Use this for initialization
    void Start()
    {
        PlayerManager       = GameObject.Find("SmallHuman_001");
        playerManagerScript = PlayerManager.GetComponent <Player_Manager>();

        poweringSwing    = false;
        releaseSwing     = false;
        swingPower       = 0.0f;
        swingPowerActual = 0.0f; //actual recorded power player pushes button for during the golf swing
    }
Beispiel #26
0
    void Awake()
    {
        Instance = this;

        roleListDefine = ScriptableObject.CreateInstance <RoleList_Define>();

        cardDeckListDefine = ScriptableObject.CreateInstance <CardDeckList_Define>();

        DontDestroyOnLoad(this.gameObject);
    }
Beispiel #27
0
 // Update is called once per frame
 void Awake()
 {
     gm             = GameObject.Find("GameManager").GetComponent <GameManager>();
     InvaderManager = GameObject.Find("InvaderManager");
     IM             = (Invader_Manager)InvaderManager.GetComponent(typeof(Invader_Manager));
     PlayerManager  = GameObject.Find("PlayerManager");
     PM             = (Player_Manager)PlayerManager.GetComponent(typeof(Player_Manager));
     rb2d           = GetComponent <Rigidbody2D> ();
     player         = GameObject.Find("Player_Ship");
     p = (PlayerShip)player.GetComponent(typeof(PlayerShip));
 }
Beispiel #28
0
 void Awake()
 {
     PlayerManager     = GameObject.Find("PlayerManager");
     InvaderManager    = GameObject.Find("InvaderManager");
     IM                = (Invader_Manager)InvaderManager.GetComponent(typeof(Invader_Manager));
     PM                = (Player_Manager)PlayerManager.GetComponent(typeof(Player_Manager));
     LevelManager      = GameObject.Find("LevelManager");
     LM                = (Level_Manager)LevelManager.GetComponent(typeof(Level_Manager));
     randomNumber      = Random.Range(0, IM.explosions.Length);
     barrierSound      = GetComponent <AudioSource> ();
     barrierSound.clip = LM.invadermarchSound [2];
 }
 void Awake()
 {
     gm             = GameObject.Find("GameManager").GetComponent <GameManager>();
     InvaderManager = GameObject.Find("InvaderManager");
     IM             = (Invader_Manager)InvaderManager.GetComponent(typeof(Invader_Manager));
     PlayerManager  = GameObject.Find("PlayerManager");
     PM             = (Player_Manager)PlayerManager.GetComponent(typeof(Player_Manager));
     LevelManager   = GameObject.Find("LevelManager");
     LM             = (Level_Manager)LevelManager.GetComponent(typeof(Level_Manager));
     rb2d           = GetComponent <Rigidbody2D> ();
     randomNumber   = Random.Range(0, IM.explosions.Length);
 }
    override public BT_Status UpdateAction()
    {
        timer_attack += Time.deltaTime;
        GameObject go = father_colliders.transform.GetChild((int)dir_collider).gameObject;

        if (!slash_done)
        {
            get_damage_collider.enabled = false;
            go.SetActive(true);
            BoxCollider2D col = go.GetComponent <BoxCollider2D>();
            player_detection_slash = Physics2D.OverlapBox(go.transform.position, col.size, 0, player_mask);

            if (timer_attack > time_to_make_slash)
            {
                timer_attack = 0.0f;
                slash_done   = true;
            }
        }
        else
        {
            go.SetActive(false);
            if (player_detection_slash != null)
            {
                Transform parent = player_detection_slash.transform.parent;

                if (parent != null)
                {
                    Player_Manager player_manager_scr = parent.GetComponent <Player_Manager>();

                    if (player_manager_scr != null)
                    {
                        player_manager_scr.GetDamage(transform);
                        slash_done             = false;
                        player_detection_slash = null;
                        BT_Kelpi kelpi_bt = ((BT_Kelpi)myBT);
                        if (kelpi_bt != null)
                        {
                            kelpi_bt.Set_Can_Make_Slash(false);
                        }
                    }
                }
            }
            else
            {
                //Stop
                get_damage_collider.enabled = true;
            }
            isFinish = true;
        }


        return(BT_Status.RUNNING);
    }