예제 #1
0
    // Use this for initialization
    void Awake()
    {
        playerControl = gameObject.GetComponent<Player_Control> ();

        player = GetComponent<Rigidbody2D> ();
        playerSprite = GetComponent<SpriteRenderer> ();
        playerAnimation = GetComponent<Animator> ();

        playerSpeed = 5.0f;
        playerHP = maxHP = 3;
        nextVuln = 0.0f;
        invincTime = 2.0f;
        playerAlive = true;

        upVec = new Vector2 (0, playerSpeed);
        rightVec = new Vector2 (playerSpeed, 0);
        upRightVec = new Vector2 (Mathf.Sqrt (2) / 2 * playerSpeed, Mathf.Sqrt (2) / 2 * playerSpeed);
        downRightVec = new Vector2 (Mathf.Sqrt (2) / 2 * playerSpeed, -Mathf.Sqrt (2) / 2 * playerSpeed);
        offset = new Vector2 (0, 0.8f);
        screenSize = new Vector2 (4.5f, 5.4f);

        gameOver = GameObject.Find ("Canvas").GetComponent<Game_Over_Script> ();

        keyCount = 0;
        maxKeys = 5;
    }
예제 #2
0
 public void SpawnActors(int numPlayers)
 {
     for (int i = 0; i < numPlayers; i++)
     {
         Color  playerCol;
         string team;
         bool   leftTeam;
         if (i == 0 || i == 2)
         {
             playerCol = colour_Left;
             team      = "Left";
             leftTeam  = true;
         }
         else
         {
             playerCol = colour_Right;
             team      = "Right";
             leftTeam  = false;
         }
         GameObject     newPlayer = Instantiate(defaultPlayer, spawn_Players[i].position, spawn_Players[i].rotation, agentSpace);
         Player_Control PC        = newPlayer.GetComponent <Player_Control>();
         newPlayer.transform.localScale = new Vector3(1, 1, 1);
         newPlayer.name         = team + "Player_" + i;
         PC.body.material.color = playerCol;
         PC.playerNum           = i + 1;
         PC.freeze   = true;
         PC.AM       = GetComponent <ArenaMaster>();
         PC.leftTeam = leftTeam;
         Players[i]  = newPlayer;
     }
     activeBall = Instantiate(defaultBall, spawn_Balls.position, spawn_Balls.rotation, agentSpace);
     activeBall.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
 }
예제 #3
0
    public void Change_Glucose_Controls(Player_Control Control)
    {
        Glucose_Control = Control;
        switch (Control)
        {
        case Player_Control.Dead:
            Glucose_An.Launch_Death_Animation();
            // Fade out Master sound before reoload
            Audio_Mixer_Control.current.Fade_Master(-80, 1.5f);

            // Call Reload event
            Event_System.current.Reload_Level();
            break;

        default:
            break;
        }


        // toggles other scripts controls
        Glucose_Mo.Toggle_Movement(Control);

        Glucose_An.Change_Animation_Control(Control);

        print("Glucose Control States updated to " + Glucose_Control);
    }
예제 #4
0
    // Start is called before the first frame update
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        Player_Control playerScript = player.GetComponent <Player_Control>();

        DontDestroyOnLoad(this.gameObject);
    }
    // Update is called once per frame
    void Update()
    {
        var box = colidbox.transform.position;
        //transform.Translate(direction * speed * d_t * 15);

        //충돌관리
        Ray2D        ray = new Ray2D(box, new Vector2(1, 0));
        RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction);

        if (Physics2D.Raycast(ray.origin, ray.direction, 0.1f) && hit.collider.tag == "map")
        {
            blocks.Play();
            Destroy(gameObject);
        }


        if (Physics2D.Raycast(ray.origin, ray.direction, 0.1f) && hit.collider.tag == "Player")
        {
            Player_Control p_c = hit.collider.gameObject.GetComponent <Player_Control>();
            fe1_stand_head p_h = hit.collider.gameObject.GetComponent <fe1_stand_head>();
            if (p_c != null)
            {
                p_c.hit_damage(damage);
            }
            if (p_h != null)
            {
                p_h.hit_damage(damage);
            }

            Instantiate(Hit_fx, this.transform.position, Quaternion.identity);
            Destroy(gameObject);            // Debug.Log("hit");
        }
    }
예제 #6
0
 public void UnFreezePlayers()
 {
     foreach (GameObject player in Players)
     {
         Player_Control PC = player.GetComponent <Player_Control>();
         PC.freeze = false;
     }
 }
예제 #7
0
 private void Change_Control_To_Normal(int id)// Id is not used but requierd for the function to function
 {
     // Prevent potential case of changing glucose controle while he is dead
     if (Glucose_Control != Player_Control.Dead)
     {
         Glucose_Control = Player_Control.Normal;
     }
 }
예제 #8
0
    // Use this for initialization
    void Start()
    {
        SetImageActiveState(true, false);


        m_Player_Control         = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Control>();
        m_normalImage.fillAmount = 1;
    }
 void OnTriggerEnter(Collider other)
 {
     if(other.tag=="Player")
     {
         player = other.GetComponent<Player_Control>();
         player.ReceiveDamage(ATK);
     }
     Destroy(this.gameObject);
 }
예제 #10
0
    // Use this for initialization
    void Start()
    {
        movePlayer   = transform.GetChild(1).GetComponent <AudioSource> ();
        attackPlayer = transform.GetChild(2).GetComponent <AudioSource> ();
        myRigidbody  = GetComponent <Rigidbody2D> ();
        myControl    = GetComponent <Player_Control> ();

        mpCurrentClip = NONE;
    }
예제 #11
0
    void Awake()
    {
        pc = GetComponent <Player_Control>();
        if (random)
        {
            id_body    = Random.Range(0, 5);
            id_wheels  = Random.Range(0, 4);
            id_front   = Random.Range(0, 3);
            id_spoiler = Random.Range(0, 4);
        }
        else if (custom)
        {
            LoadCar lc = GameObject.Find("CarObject").GetComponent <LoadCar>();
            switch (pc.ID)
            {
            case 1:
                id_body    = lc.player1Parts[0];
                id_wheels  = lc.player1Parts[1];
                id_front   = lc.player1Parts[2];
                id_spoiler = lc.player1Parts[3];
                break;

            case 2:
                id_body    = lc.player2Parts[0];
                id_wheels  = lc.player2Parts[1];
                id_front   = lc.player2Parts[2];
                id_spoiler = lc.player2Parts[3];
                break;

            case 3:
                id_body    = lc.player3Parts[0];
                id_wheels  = lc.player3Parts[1];
                id_front   = lc.player3Parts[2];
                id_spoiler = lc.player3Parts[3];
                break;

            case 4:
                id_body    = lc.player4Parts[0];
                id_wheels  = lc.player4Parts[1];
                id_front   = lc.player4Parts[2];
                id_spoiler = lc.player4Parts[3];
                break;
            }
        }
        body    = GameObject.Find("Parts").GetComponent <Parts>().body[id_body];
        wheel   = GameObject.Find("Parts").GetComponent <Parts> ().wheel [id_wheels];
        spoiler = GameObject.Find("Parts").GetComponent <Parts> ().spoiler_addon [id_spoiler]; spoiler.name = "spoiler";
        front   = GameObject.Find("Parts").GetComponent <Parts> ().front_addon [id_front];
        m       = GetComponent <Car_Movement> (); damage = GetComponent <Car_Damage> ();

        visuals = GetComponent <Visual_Update> ();

        if (!display)
        {
            race = GameObject.Find(GameObject.Find("Game").GetComponent <Game>().track).GetComponentInChildren <Race>();
        }
    }
예제 #12
0
 // Start is called before the first frame update
 void Start()
 {
     Glucose_Vibe    = Player_Emotion.Normal;
     Glucose_Control = Player_Control.Normal;
     Glucose_An      = GetComponent <Glucose_Animation>();
     Glucose_Mo      = GetComponent <Glucose_Controls>();
     Glucose_Att     = GetComponent <Glucose_Attack>();
     Event_System.current.onCinematicBegin += Change_Control_To_Cinematic;
     Event_System.current.onCinematicEnd   += Change_Control_To_Normal;
 }
예제 #13
0
 void Start()
 {
     Cooling    = false;
     Origin     = GameObject.Find("Origin").transform;
     ParentBody = GameObject.Find("Avatar").GetComponent <Rigidbody>();
     PA         = transform.GetComponent <Animator>();
     Cam        = Camera.main;
     Cam2       = GameObject.Find("GunCam").GetComponent <Camera>();
     Player     = ParentBody.GetComponent <Player_Control>();
 }
 void Start()
 {
     // Get the UI_Main script of the UI game object and assign it to the gamePause local variable.
     gamePause  = GameObject.Find("UI").GetComponent <UI_Main>();
     MissleLock = false;
     // Get the Player_Control script from the player in world and assign it to the WeaponsUnlocked local variable,
     // This is to track if the player has any specific weapon upgrades, and how many of them.
     WeaponsUnlocked = WeaponSystems.GetComponent <Player_Control>();
     AmmoPool        = GameObject.Find("GameMaster").GetComponent <Pooling>();
 }
예제 #15
0
 void OnTriggerStay(Collider col)
 {
     if (col.tag == "Player" && active)
     {
         PC = col.gameObject.GetComponent <Player_Control>();
         Pickups[activePickup].SetActive(false);
         active = false;
         PickUp();
         timer = Time.time + interval;
     }
 }
예제 #16
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Debug.LogError("More Than two instance");
        }

        uiSkillManager = GameObject.Find("UISkillManager").GetComponent <UISkillManager>();
    }
예제 #17
0
    public override void Use(ref gameItem currItem)
    {
        Player_Control player = GameController.instance.player.GetComponent <Player_Control>();

        if (player.equipment[(int)this.part] == null || ItemController.instance.items[player.equipment[(int)this.part].itemFileName].itemName != this.itemName)
        {
            player.ACT_Equip(currItem);
        }
        else
        {
            player.ACT_UnEquip(part);
        }
    }
예제 #18
0
 // initialization for the class
 public void Start()
 {
     gamePause = GameObject.Find("UI").GetComponent <UI_Main>();
     SpawnFormations();
     // grab the player control script from the player in the world and assign it to the local player variable.
     player      = GameObject.FindWithTag("Player").GetComponent <Player_Control>();
     EnemyParent = GameObject.Find("EnemiesParent");
     if (SetWave > 0)
     {
         WaveCount = SetWave;
     }
     GetTotalSpawnsFromWave();
 }
	// Use this for initialization
	void Start () {
		pc = GameObject.FindGameObjectWithTag("Player").GetComponent<Player_Control>();
		timer += Time.deltaTime;
		useSlots();
		/*
		slots = new Transform[this.transform.childCount];
		for(int i =0;i<slots.Length;i++){
			
			slots[i] = this.transform.GetChild(i);
			
			
		}
		*/
	}
 // This is basically the start function for the base class.
 public void FindTheComponents()
 {
     UpgradeMaster = Resources.Load <GameObject>("Upgrades/UpgradesMaster") as GameObject;
     SetTheUpgrades();
     spawner                = GameObject.Find("EnemySpawning").GetComponent <EnemySpawning>();
     ScoreSet               = GameObject.Find("UI").GetComponent <UI_Main>();
     UpgradeDetect          = GameObject.Find("UpgradeBrain(Clone)").GetComponent <Upgrades>();
     AssetPool              = GameObject.Find("GameMaster").GetComponent <Pooling>();
     boxColFoV              = transform.GetChild(1).gameObject.GetComponent <BoxCollider>();
     objWeaponSpawnLocation = transform.GetChild(2).gameObject;
     fOriginAngle           = transform.eulerAngles.y;
     multiShotCount         = spawner.GetPlayerRef();
     StartingVectorX        = gameObject.transform.position.x;
     StartingVectorZ        = gameObject.transform.position.z;
 }
예제 #21
0
    // Use this for initialization
    void Start()
    {
        pc     = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Control>();
        timer += Time.deltaTime;
        useSlots();

        /*
         * slots = new Transform[this.transform.childCount];
         * for(int i =0;i<slots.Length;i++){
         *
         *      slots[i] = this.transform.GetChild(i);
         *
         *
         * }
         */
    }
예제 #22
0
 void Start()
 {
     Player          = FindObjectOfType <Player_Control>();
     RB              = GetComponent <Rigidbody>();
     Origin          = transform.position;
     RayOriginOffset = new Vector3(0, 0.5f, 0);
     //Cycles below
     if (!HasPath)
     {
         InvokeRepeating("NewDirection", IdelPathTime, IdelPathTime);
     }
     InvokeRepeating("Lingering", IdelPathTime * IdelPathTime, IdelPathTime * IdelPathTime);
     InvokeRepeating("RandomDetect", (float)IdelPathTime / 2, (float)IdelPathTime / 2);
     InvokeRepeating("Navigate", 0.2f, 0.2f);
     Idel = true;
 }
예제 #23
0
 void Start()
 {
     player = FindObjectOfType <Player_Control> ();
     sm     = FindObjectOfType <ScenesManager> ();
     ds     = FindObjectOfType <DataStorage> ();
     sound  = FindObjectOfType <SoundManager> ();
     keys   = 0;
     coins  = 0;
     if (ds.touchControls)
     {
         gameControls.SetActive(false);
     }
     else
     {
         gameControls.SetActive(true);
     }
 }
    public override void Pressed()
    {
        Player_Control player = GameController.instance.player.GetComponent <Player_Control>();


        if (player.equipment[(int)bodyPart.Hand] != null && ItemController.instance.items[player.equipment[(int)bodyPart.Hand].itemFileName] is Equipable_Key)
        {
            if (!WaitForBool || (WaitForBool && GameController.instance.globalBools[ThisValue]))
            {
                Equipable_Key key;
                key = (Equipable_Key)ItemController.instance.items[player.equipment[(int)bodyPart.Hand].itemFileName];
                if (key.level >= Clearance)
                {
                    Door01.GetComponent <Object_Door>().DoorSwitch();
                    if (Door02 != null)
                    {
                        Door02.GetComponent <Object_Door>().DoorSwitch();
                    }
                    soundsource.PlayOneShot(Accepted);
                    SubtitleEngine.instance.playSub("playStrings", "play_button_card");
                }
                else
                {
                    SubtitleEngine.instance.playSub("playStrings", "play_button_lowcard");
                    soundsource.PlayOneShot(Rejected);
                }
            }
            else
            {
                SubtitleEngine.instance.playSub("playStrings", "play_button_failcard");
                soundsource.PlayOneShot(Rejected);
            }
        }
        else
        {
            SubtitleEngine.instance.playSub("playStrings", "play_button_nocard");
        }
    }
예제 #25
0
    public override void Pressed()
    {
        Player_Control player = GameController.instance.player.GetComponent <Player_Control>();

        if (!WaitForBool || (WaitForBool && GameController.instance.globalBools[ThisValue]))
        {
            if (player.equipment[(int)bodyPart.Hand] != null && ItemController.instance.items[player.equipment[(int)bodyPart.Hand].itemFileName] is Equipable_Hand)
            {
                Equipable_Hand hand;
                hand = (Equipable_Hand)ItemController.instance.items[player.equipment[(int)bodyPart.Hand].itemFileName];
                if (hand.handID == handID)
                {
                    Door01.GetComponent <Object_Door>().DoorSwitch();
                    if (Door02 != null)
                    {
                        Door02.GetComponent <Object_Door>().DoorSwitch();
                    }
                    soundsource.PlayOneShot(Accepted);
                    SubtitleEngine.instance.playSub("playStrings", "play_button_dna");
                }
                else
                {
                    SubtitleEngine.instance.playSub("playStrings", "play_button_wrongdna");
                    soundsource.PlayOneShot(Rejected);
                }
            }
            else
            {
                SubtitleEngine.instance.playSub("playStrings", "play_button_wrongdna");
                soundsource.PlayOneShot(Rejected);
            }
        }
        else
        {
            SubtitleEngine.instance.playSub("playStrings", "play_button_faildna");
            soundsource.PlayOneShot(Rejected);
        }
    }
예제 #26
0
    void Awake()
    {
        stageNum = Scene_Manager_Script.instance._nowStage;

        _uniqueInstance = this;
        _isDead         = false;
        _isEnd          = false;
        _isSuccess      = false;
        _isClicked      = false;

        stageSelect(stageNum);

        go        = GameObject.FindGameObjectWithTag("stage");
        obManger  = go.transform.GetChild(0).GetComponent <Obstacle_Manager>();
        go        = GameObject.FindGameObjectWithTag("Monster");
        _monster  = go.GetComponent <Monster_Control>();
        go        = GameObject.FindGameObjectWithTag("Player");
        _player   = go.GetComponent <Player_Control>();
        go        = GameObject.Find("MessageBG");
        _MsgBox   = go.GetComponent <MessageBox>();
        go        = GameObject.Find("ScoreBG");
        _txtScore = go.transform.GetChild(1).GetComponent <Text>();
    }
    // Use this for initialization
    void Start()
    {
        player = FindObjectOfType <Player_Control> ();

        if (textfile != null)
        {
            textLines = (textfile.text.Split('\n'));
        }

        if (endAtLine == 0)
        {
            endAtLine = textLines.Length - 1;
        }

        if (isActive)
        {
            EnableTextBox();
        }
        else
        {
            DisableTextBox();
        }
    }
예제 #28
0
 void OnCollisionEnter(Collision col)
 {
     if (col.collider.tag == "Player")
     {
         Player_Control PC = col.gameObject.GetComponent <Player_Control>();
         if (PC.leftTeam != leftTeam)
         {
             if (charging && !PC.charging)
             {
                 //Is this fun?
                 float vel = rb.velocity.magnitude * (rb.mass / 2);
                 charging = false;
                 Rigidbody enemyRB = col.collider.gameObject.GetComponent <Rigidbody>();
                 enemyRB.AddForce(transform.forward * vel, ForceMode.Impulse);
                 impactFX.SetActive(true);
                 PC.Slammed();
             }
         }
         else
         {
             print("Hit a bro!");
         }
     }
 }
 void Start()
 {
     player      = FindObjectOfType <Player_Control> ();
     isFollowing = true;
 }
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType <Player_Control> ();
 }
예제 #31
0
 void OnTriggerStay(Collider other)
 {
     if (Contact == true)
     {
         if (other.tag == "Player")
         {
             if (Skill_ColdDown > 0)
             {
                 Skill_ColdDown -= 1;
             }
             else
             {
                 player = other.GetComponent<Player_Control>();
                 player.ReceiveDamage(ATK3);
                 Skill_ColdDown = Attack3_ColdDown_Set;
             }
         }
     }
 }
예제 #32
0
 void Player_Hit()
 {
     hitColliders = Physics.OverlapSphere(Attack1_Pos.transform.position, Attack1_Range, PlayerCheckLayer);
     if (hitColliders.Length != 0)
     {
         player = hitColliders[0].GetComponent<Player_Control>();
         player.ReceiveDamage(ATK1);
     }
 }
예제 #33
0
 // Start is called before the first frame update
 void Start()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     playerScript = player.GetComponent <Player_Control>();
     gold         = GameObject.FindGameObjectWithTag("GoldTotal").GetComponent <Text>();
 }
예제 #34
0
 private void Change_Control_To_Cinematic(int id)// Id is not used but requierd for the function to function (function to function lol)
 {
     Glucose_Control = Player_Control.Cinematic;
 }
예제 #35
0
 private void Start()
 {
     TrajectoryLineRenderer.enabled = false;
     m_playerControl = transform.GetComponent <Player_Control>();
 }
예제 #36
0
    // Use this for initialization
    void Start()
    {
        //Get the player's transform and control script
        target = GameObject.FindGameObjectWithTag("Player").transform;
        player_control = GameObject.FindGameObjectWithTag("Player").GetComponent<Player_Control>();

        //Get this zombie's behaviour script
        behaviour = gameObject.GetComponent<Zombie_Bahaviour>();

        player_in_threat_zone = false;

        //First step is to make sure this zombie is not dead
        zombie_action = Check_If_Self_Dead;
        decision_tree_root = Check_If_Self_Dead;

        randomly_walking = false;
        idling = false;
    }