コード例 #1
0
    private void Awake()
    {
        player     = GameObject.FindObjectOfType <PlayerMovement>().gameObject;
        playerLife = player.gameObject.GetComponent <Life_Attributes>();

        lifeBarStatus     = lifeBar.gameObject.GetComponent <Animator>();
        gadgetDisplayAnim = gadgetDisplay.gameObject.GetComponent <Animator>();



        //Because this will reference an array and arrays start with 0
        thisArea = area - 1;

        medalionID01 = (int)Random.Range(1, 6);

        if (medalionID01 >= 5)
        {
            medalionID01 = 5;
        }
        medalionID02 = (int)Random.Range(1, 5);
        if (medalionID02 == medalionID01)
        {
            if (medalionID01 != 5)
            {
                medalionID02 = 5;
            }
            else
            {
                medalionID02 = medalionID01 + 1;
            }


            if (medalionID02 >= 5)
            {
                medalionID02 = 1;
            }
        }



        Debug.Log("MedalionID01 = " + medalionID01 + " and MedalionID02 = " + medalionID02);
    }
コード例 #2
0
    private void Start()
    {
        movement = this.gameObject.GetComponent <Movement>();
        life     = this.gameObject.GetComponent <Life_Attributes>();

        animator = gameObject.GetComponent <Animator>();


        // Values bellow will change accordingly to the difficulty set in MatchInfo

        int hpBoost     = levelConsole.GetComponent <MatchInfo>().difficultyLvl * 40;
        int attackBoost = levelConsole.GetComponent <MatchInfo>().difficultyLvl * 5;

        Life_Attributes myLifeAttributes = this.gameObject.GetComponent <Life_Attributes>();

        myLifeAttributes.maxHP += hpBoost;

        myLifeAttributes.hP += hpBoost;
        attackPower         += attackBoost;

        oldThrowForce = throwForce;

        whatIsWall = this.gameObject.GetComponent <Movement>().whatIsWall;
    }