コード例 #1
0
ファイル: Round0_GameManager.cs プロジェクト: jeesub/BVW
    // Start is called before the first frame update
    void Start()
    {
        player       = GameObject.FindGameObjectWithTag("Player");
        wizardHat    = GameObject.FindObjectOfType <WizardHat>();
        alien        = GameObject.FindObjectOfType <Alien>();
        key          = GameObject.FindObjectOfType <Key>();
        gate         = GameObject.FindObjectOfType <Gate>();
        waterBalloon = GameObject.FindObjectOfType <WaterBalloon>();
        fire         = GameObject.FindObjectOfType <Fire>();
        hammer       = GameObject.FindObjectOfType <Hammer>();
        stone        = GameObject.FindObjectOfType <Stone>();

        audioSource = GetComponent <AudioSource>();
        Init();
    }
コード例 #2
0
    public void OnCreateNewRandomItem()
    {
        // Create a wizard hat because that's the only item type we have right now
        var item = new WizardHat();

        Representation.text = item.Representation;

        // Get 2 random affixes
        var randomAffixes = affixTypes.GetRandomSample(Random.Range(1, 4));

        // Decorate it
        var a = randomAffixes.Aggregate <Type, Item>(item, (b, c) => (ItemAffix)Activator.CreateInstance(c, b));

        // Show the name and effect
        Title.text   = a.Name;
        Effects.text = a.Description;
    }