Пример #1
0
 // Start is called before the first frame update
 protected override void Start()
 {
     base.Start();
     controller    = GetComponent <PlayerContoller>();
     gunController = GetComponent <GunController>();
     viewCamera    = Camera.main;
 }
Пример #2
0
 void Start()
 {
     player = FindObjectOfType <PlayerContoller>();
     //xHealth = player.m_iMaxHealth;
     //healthBar = transform.Find("HealthBarContent").GetComponent<Image>();
     //energyBar = transform.Find("EnergyBarContent").GetComponent<Image>();
 }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.Find ("Player");
        pc = player.GetComponent<PlayerContoller> ();

        StartCoroutine ("spawnClock");
    }
Пример #4
0
    void Start()
    {
        enemySpawner = gameObject.GetComponent <EnemySpawnerScript>();
        playerCont   = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerContoller>();

        // light source location init
        // level 1
        lightSourceLocation[0, 0] = new Vector3(24, 0, 0);

        // level 2
        lightSourceLocation[1, 0] = new Vector3(-18, 0, 27);

        // level 3
        lightSourceLocation[2, 0] = new Vector3(-34, 0, 0);

        // level 4
        lightSourceLocation[3, 0] = new Vector3(22, 0, 27);

        lightSourceLocation[4, 0] = new Vector3(0, 0, 0);

        lightSourceLocation[5, 0] = new Vector3(0, 0, -11);

        lightSourceLocation[6, 0] = new Vector3(0, 0, -27);

        lightSourceLocation[7, 0] = new Vector3(0, 0, 46);

        lightSourceLocation[8, 0] = new Vector3(0, 0, -45);
    }
Пример #5
0
 // Start is called before the first frame update
 void Awake()
 {
     Time.timeScale = 1;
     timestamp      = Time.time + delay;
     scrollingMat.SetFloat("Vector1_79A07576", fallSpeed);
     playCont = player.gameObject.GetComponent <PlayerContoller>();
 }
Пример #6
0
 public void OnPickup(PlayerContoller player)
 {
     player.m_iEnergy = player.m_iMaxEnergy;
     player.m_iHealth = player.m_iMaxHealth;
     SoundManager.Instance.PlayEvent(SoundEvents.Play_LS_Absorb, this.gameObject);
     m_bDidPlayerEatMe = true;
     Die();
 }
Пример #7
0
 private void Awake()
 {
     controller  = GetComponent <PlayerContoller>();
     delayTimer  = new Timer(reactionDelay);
     runAwayFrom = new List <Vector3>();
     getCloseTo  = new List <Vector3>();
     missleTimer = new Timer(10);
 }
Пример #8
0
    void Start()
    {
        m_slider = GameObject.Find("Slider").GetComponent <Slider>();
        player   = FindObjectOfType <PlayerContoller>();

        m_slectCanvas = GameObject.Find("SelectCanvas");
        m_slectCanvas.SetActive(false);
    }
Пример #9
0
 // Use this for initialization
 void Awake()
 {
     m_CollectableText      = GetComponent <Text>();
     m_Player               = FindObjectOfType <PlayerContoller>();
     totalCollectables      = FindObjectsOfType <Collectables>().Length;
     m_CollectableText.text = m_Player.CollectablesCollected + " of " + totalCollectables + " Collectables Found!";
     print("!!!!!!!!!!!!!!!!!!!!!!!!! " + m_CollectableText.text);
 }
Пример #10
0
    public void OnCollisionExit(Collision collision)
    {
        PlayerContoller pc = collision.gameObject.GetComponent <PlayerContoller>();

        if (pc != null)
        {
            pc.transform.SetParent(null, true);
        }
    }
Пример #11
0
 private void Awake()
 {
     _anim              = GetComponent <Animator>();
     _playerContollerl  = GetComponent <PlayerContoller>();
     _playerShootings   = GameObject.FindGameObjectsWithTag("Gun");
     CurrentHealth      = StartingHealth;
     HealthSlider.value = CurrentHealth;
     _shieldParticles   = GetComponent <ParticleSystem>();
 }
Пример #12
0
    /// <summary>
    /// Function to update the defense value of player on UI
    /// </summary>
    /// <param name="pc"></param>
    void updateDefValue(PlayerContoller pc)
    {
        int defValue = pc.getDefenseValue();

        if (defValue >= 0)
        {
            defValue_text.SetText("Defense Value: " + defValue);
        }
    }
Пример #13
0
    public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager,
                                                           GameObject lobbyPlayer, GameObject gamePlayer)
    {
        LobbyPlayer     lobby       = lobbyPlayer.GetComponent <LobbyPlayer>();
        PlayerContoller localPlayer = gamePlayer.GetComponent <PlayerContoller>();

        localPlayer.username    = lobby.playerName;
        localPlayer.playerColor = lobby.playerColor;
    }
Пример #14
0
 void Start()
 {
     Unit     = builder.GetComponent <StageBuild>().BaseLength;
     before_x = transform.position.x;
     before_y = transform.position.y;
     PC       = GetComponent <PlayerContoller>();
     GetMapdata();
     SetToward();
 }
Пример #15
0
    // Start is called before the first frame update
    void Start()
    {
        //InvokeRepeating("SpawnObstacle", startDelay, repeatRate); // call the function constantly
        playerControllerScript = GameObject.Find("Player").GetComponent <PlayerContoller>();
        // find the player in the scene by it's name and retrieve its script

        //other method at random parameters
        Invoke("SpawnObstacle", (Random.Range(repeatRateMin, repeatRateMax)));
    }
Пример #16
0
    public void GetRigidbody(Collider col)
    {
        PlayerContoller player = col.GetComponent <PlayerContoller>();

        if (player)
        {
            Rigidbody rb = player.GetComponent <Rigidbody>();
            CheckDirection(rb);
        }
    }
Пример #17
0
    public void OnTriggerExit(Collider other)
    {
        PlayerContoller player = other.GetComponent <PlayerContoller>();

        if (player == null)
        {
            return;
        }
        SceneManager.UnloadScene(m_sSceneName);
    }
Пример #18
0
    public void OnTriggerEnter(Collider other)
    {
        PlayerContoller player = other.GetComponent <PlayerContoller>();

        if (player == null)
        {
            return;
        }
        SceneManager.LoadScene(m_sSceneName, LoadSceneMode.Additive);
    }
Пример #19
0
 // Use this for initialization
 void Start()
 {
     currentTime       = 0;
     spawnTime         = Random.Range(0, 1);
     right             = true;
     speed             = -1f;
     rgb2d             = GetComponent <Rigidbody2D>();
     animator          = GetComponent <Animator>();
     AttackAudioSource = GetComponent <AudioSource>();
     playerController  = GameObject.Find("Rogue_03").GetComponent <PlayerContoller>();
 }
Пример #20
0
    void Awake()
    {
        ins        = this;
        rebirthPos = transform.position;

        spriteRenderer = GetComponent <SpriteRenderer>();
        rigid2d        = GetComponent <Rigidbody2D>();
        movement       = nextMovement = new Movement();
        enabled        = false;

        stunTimer = new Timer(EMPStunSec);
    }
Пример #21
0
 private IEnumerator SetupCollectablesHud()
 {
     while (m_Player == null)
     {
         m_Player = FindObjectOfType <PlayerContoller>();
         yield return(new WaitForSeconds(1));
     }
     m_CollectableText      = GetComponentInChildren <Text>();
     m_Player               = FindObjectOfType <PlayerContoller>();
     totalCollectables      = FindObjectsOfType <Collectables>().Length;
     m_CollectableText.text = m_Player.CollectablesCollected + " of " + totalCollectables + " Collectables Found!";
 }
Пример #22
0
 public void Update()
 {
     if (player != null)
     {
         UpdateBar(player.PercentageHealth(), healthBar);
         UpdateBar(player.PercentageEnergy(), energyBar);
     }
     else
     {
         player = FindObjectOfType <PlayerContoller>();
     }
 }
Пример #23
0
    /*
     * Updated Nov 26th 2016
     * This Script should be attached to Collectables, and allows their pickup. Script also updates HUD (must be loaded to work)
     * Note: HUD counts all Collectable items in the world (that have this script)
     */

    void Start()
    {
        m_Player                   = GameManager.Instance.m_Player;
        m_CollectablesHud          = FindObjectOfType <GameScreen>();
        m_CollectablesCollider     = GetComponent <Collider>();
        m_CollectablesMeshRenderer = GetComponent <Renderer>();

        if (m_CollectablesMeshRenderer == null)
        {
            m_CollectablesOther = GetComponentsInChildren <Renderer>();
        }
    }
Пример #24
0
    void Awake()
    {
        _instance     = this;
        speed         = 1;
        currentTime   = 0.0f;
        currentBlood  = 100;
        currentEnergy = 100;

        speed_text.text     = speed.ToString();
        time_text.text      = currentTime.ToString();
        blood_slider.value  = currentBlood;
        energy_slider.value = currentEnergy;
    }
Пример #25
0
    // Use this for initialization
    void Awake()
    {
        m_Player = FindObjectOfType <PlayerContoller>();


        if (m_Player != null)
        {
            m_PlayerCamera = FindObjectOfType <CameraFollow>();
            LoadLevel();
            m_vPlayerInitialPos = m_Player.transform.position;
            m_abiPulse          = m_Player.GetComponent <LightPulse>();
        }
    }
Пример #26
0
    public void OnTriggerEnter(Collider other)
    {
        PlayerContoller player = other.GetComponent <PlayerContoller>();

        if (player != null)
        {
            if (m_GroundParticle)
            {
                m_GroundParticle.startLifetime = 5f;
                m_GroundParticle.startColor    = Color.yellow;
            }
        }
    }
Пример #27
0
    public void OnTriggerExit(Collider other)
    {
        PlayerContoller player = other.GetComponent <PlayerContoller>();

        if (player != null)
        {
            if (m_GroundParticle)
            {
                m_GroundParticle.startLifetime = 2.59f;
                m_GroundParticle.startColor    = Color.white;
            }
        }
    }
Пример #28
0
    // Start is called before the first frame update
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            if (instance != this)
            {
                Destroy(gameObject);
            }
        }

        DontDestroyOnLoad(gameObject);
    }
Пример #29
0
    public void OnTriggerStay(Collider other)
    {
        PlayerContoller player = other.GetComponent <PlayerContoller>();

        if (player != null)
        {
            if (player.m_iHealth < player.m_iMaxHealth)
            {
                player.Heal(1);
            }
            if (player.m_iEnergy < player.m_iMaxEnergy)
            {
                player.m_iEnergy++;
            }
        }
    }
Пример #30
0
    void Start()
    {
        m_bommer    = FindObjectOfType <BommerController>();
        m_playerC   = FindObjectOfType <PlayerContoller>();
        m_rigidbody = GetComponent <Rigidbody2D>();
        m_hit       = FindObjectOfType <HitExplosion>();

        m_player    = GameObject.Find("player").gameObject;
        m_hitObject = transform.GetChild(0).gameObject;

        m_hitObject.SetActive(false);

        Vector2 vector = m_player.transform.position - this.transform.position;

        m_rigidbody.AddForce(vector, ForceMode2D.Impulse);
        Invoke("Explosion", 3.0f);
    }
Пример #31
0
    void Awake()
    {
        //get component
        rb   = GetComponent <Rigidbody>();
        anim = GetComponentInChildren <Animator>();

        // get player
        player = FindObjectOfType <PlayerContoller>();

        if (player == null)
        {
            Debug.LogError("There needs to be a PlayerController in the scene");
        }

        // search for the player at an interval of 0.5 seconds
        InvokeRepeating("LookForPlayer", 0, 0.5f);
    }