示例#1
0
    private void Start()
    {
        GameObject gameControllerObject =
            GameObject.FindGameObjectWithTag("GameController");

        if (gameControllerObject != null)
        {
            _gameController =
                gameControllerObject.GetComponent <GameController>();
        }

        if (_gameController == null)
        {
            Debug.Log("Cannot find 'GameController' script");
        }

        GameObject playerObject =
            GameObject.FindGameObjectWithTag("Player");

        if (playerObject != null)
        {
            _player =
                playerObject.GetComponent <PlayerInputControl>();
        }

        if (_player == null)
        {
            Debug.Log("Cannot find 'GameController' script");
        }
    }
示例#2
0
    void OnTriggerEnter(Collider other)
    {
        // if (other.name.Equals("player"))
        if (other.gameObject.CompareTag("Player"))
        {
            GameObject gameControllerObject =
                GameObject.FindGameObjectWithTag("GameController");
            GameObject playerObject =
                GameObject.FindGameObjectWithTag("Player");
            if (gameControllerObject != null)
            {
                _gameController =
                    gameControllerObject.GetComponent <GameController>();
                _player = playerObject.GetComponent <PlayerInputControl>();
            }

            if (gameControllerObject == null)
            {
                Debug.Log("Cannot find 'game controller' script");
            }

            Debug.Log("!!");
            _player.protecter.gameObject.SetActive(true);
            Destroy(gameObject);
        }
    }
示例#3
0
文件: Hero.cs 项目: 843402802/RPGGame
 void Start()
 {
     _Animation            = GetComponentInChildren <Animation>();
     _CharacterController  = GetComponent <CharacterController>();
     _HeroAnimationControl = GetComponent <HeroAnimationControl>();
     _HeroAttackControl    = GetComponent <HeroAttackControl>();
     _PlayerInputControl   = GetComponent <PlayerInputControl>();
     _HeroProperty         = GetComponent <HeroProperty>();
 }
示例#4
0
 void Start()
 {
     //变量初始化
     PIC                 = GetComponent <PlayerInputControl>();
     inputEffective      = true;
     InputedMovements    = new List <string>();
     MasteredComboSkills = new List <ComboSkill>();
     MasteredComboSkills.Add(c1);
     MasteredComboSkills.Add(c2);
     tempPossibleComboSkills = new List <ComboSkill>(MasteredComboSkills);
 }
    //player stats and info


    private void Awake()
    {
        if (player == null)
        {
            DontDestroyOnLoad(gameObject);
            player = this;
        }
        else if (player != this)
        {
            Destroy(gameObject);
        }
    }
示例#6
0
    private void Start()
    {
        GameObject playerObject = GameObject.FindGameObjectWithTag("Player");

        if (playerObject != null)
        {
            _player        = playerObject.GetComponent <PlayerInputControl>();
            this.speed     = _player.speed;
            this.yPosition = _player.yPosition;
            this.angle     = _player.angle;
        }

        if (playerObject == null)
        {
            Debug.Log("Cannot find 'player' script");
        }
    }
示例#7
0
    void OnTriggerEnter(Collider other)
    {
//        Debug.Log(" i have detected the collision ");
        // if (other.name.Equals("player"))
        if (other.gameObject.CompareTag("Player"))
        {
            GameObject playerObject =
                GameObject.FindGameObjectWithTag("Player");
            if (playerObject != null)
            {
                _player = playerObject.GetComponent <PlayerInputControl>();
            }

            if (playerObject == null)
            {
                Debug.Log("Cannot find 'player' script");
            }

            Destroy(this.gameObject);

            // change the type of the spaceship of player
            curr_player_type = _player.getPlayer_type();

            if (curr_player_type == 0)
            {
                _player.GetComponent <MeshFilter>().mesh   = upgradeMesh_1;
                _player.GetComponent <Renderer>().material = upgradeMaterial_1;
                _player.setPlayer_type(1);
            }

            if (curr_player_type == 1)
            {
                _player.GetComponent <MeshFilter>().mesh   = upgradeMesh_2;
                _player.GetComponent <Renderer>().material = upgradeMaterial_2;
                _player.setPlayer_type(2);
            }
        }
    }
示例#8
0
    private void OnTriggerEnter(Collider other)
    {
        // if (other.name.Equals("player"))
        if (other.gameObject.CompareTag("Player"))
        {
            GameObject playerObject =
                GameObject.FindGameObjectWithTag("Player");
            if (playerObject != null)
            {
                _player = playerObject.GetComponent <PlayerInputControl>();
            }

            if (playerObject == null)
            {
                Debug.Log("Cannot find 'player' script");
            }

            Destroy(this.gameObject);

            // change the type of the bolt_type of player
            _player.setBolt_type(bolt_type);
        }
    }
示例#9
0
 void Awake()
 {
     pic   = GetComponent <PlayerInputControl>();
     psc   = GetComponent <PlayerStatsCounter>();
     trans = transform;
 }