示例#1
0
    // Use this for initialization
    void Start()
    {
        player           = transform.parent.GetComponent <PlayerController> ();
        cm               = transform.parent.GetComponent <SteamVR_ControllerManager> ();
        state            = ControllerState.SpawningUnits;
        lastSpawnedUnits = new List <Unit> ();
        lr               = GetComponent <LineRenderer> ();

        // left hand initialization
        if (gameObject == cm.left)
        {
            weaponTrans = transform.GetChild(1);
            bowActive   = false;
            // right hand initialization
        }
        else
        {
            bowDrawn       = false;
            fireballWeapon = GetComponent <FireballWeapon> ();
            unitWheel      = transform.GetChild(0);
        }

        bowScript = cm.left.GetComponent <BowScript> ();

        // get both ControllerExtensions for multi-hand actions (bow)
        leftExt  = cm.left.GetComponent <ControllerExtensions> ();
        rightExt = cm.right.GetComponent <ControllerExtensions> ();

        targetIndicator = utilities.GetChild(1).GetComponent <LineRenderer> ();

        unitWheelRot = 0;
    }
 void Start()
 {
     scoreTransform = null; goldCupTransform = null;
     gameOver       = false; targetReached = false;
     quitObj        = GameObject.Find("Canvas").transform.Find("Quit Image").gameObject;
     continueObj    = GameObject.Find("Canvas").transform.Find("Continue Image").gameObject;
     arrowObj       = GameObject.Find("Canvas").transform.Find("Arrow Image").gameObject;
     scoreObj       = GameObject.Find("Canvas").transform.Find("Score Image").gameObject;
     timerObj       = GameObject.Find("Canvas").transform.Find("TimerBg").gameObject;
     totalScore     = GameObject.Find("Canvas").transform.Find("TotalScore").gameObject;
     bowScript      = GameObject.Find("Bow").GetComponent <BowScript>();
     RectTransform[] rectTransforms = GetComponentsInChildren <RectTransform>();
     foreach (RectTransform rectTransform in rectTransforms)
     {
         if (rectTransform.gameObject.name.Equals("Score"))
         {
             scoreTransform = rectTransform;
         }
         if (rectTransform.gameObject.name.Equals("Arrow Text"))
         {
             arrowText = rectTransform.GetComponent <Text>();
         }
         if (rectTransform.gameObject.name.Equals("Gold Cup"))
         {
             goldCupTransform = rectTransform;
             goldCupTransform.gameObject.SetActive(false);
         }
     }
 }
示例#3
0
文件: Hero.cs 项目: Nypsyy/Discere
    private void Awake()
    {
        _player         = ReInput.players.GetPlayer(0);
        _body           = GetComponent <Rigidbody2D>();
        _health         = GetComponent <Health>();
        _mana           = GetComponent <Mana>();
        _fightingStyle  = GetComponent <FightingStyle>();
        _bowScript      = GetComponentInChildren <BowScript>();
        _spriteRenderer = anim.GetComponent <SpriteRenderer>();

        _postProcess = GameObject.FindGameObjectWithTag("Post Processing")?.GetComponent <PostProcessVolume>();
        if (_postProcess)
        {
            _ppVignette = _postProcess.profile.GetSetting <Vignette>();
        }
        if (_ppVignette)
        {
            _ppVignette.intensity.value = 0f;
        }

        // Controller map in gameplay mode
        UpdateControllerMap(Inputs.GameplayMap);
    }
示例#4
0
 // Start is called before the first frame update
 void Start()
 {
     gameScript.UpdateHealthUI(health);
     bow = FindObjectOfType <BowScript>();
 }
 // Start is called before the first frame update
 void Start()
 {
     bow = FindObjectOfType <BowScript>();
 }
示例#6
0
    public GameScript gameScript;       // Referencia do Game manager


    // Start is called before the first frame update
    void Start()
    {
        bow = FindObjectOfType <BowScript>(); // Carrega a referencia do arco
    }