コード例 #1
0
    void Start()
    {
        lightCircle.intensity = 2;
        int playerIndex = PlayerPrefs.GetInt("PlayerIndex", 1);

        rb = GetComponent <Rigidbody2D>();
        PlayerSprite.ChangeSprite(gameObject, playerIndex);
        if (playerIndex == 0)
        {
            lightCircle.color = new Color(0.5f, 0.5f, 0.2f, 1.0f);
            pointLight.color  = new Color(0.5f, 0.5f, 0.2f, 1.0f);
        }
        if (playerIndex == 1)
        {
            lightCircle.color = new Color(0.2f, 0.3f, 1.0f, 1.0f);
            pointLight.color  = new Color(0.2f, 0.5f, 1.0f, 1.0f);
        }
        else if (playerIndex == 2)
        {
            GameObject bow     = Resources.Load <GameObject>("Bow");
            GameObject bowCopy = Instantiate(bow, transform.position, Quaternion.identity);
            bowCopy.GetComponent <Bow>().player = transform;
            lightCircle.color = new Color(0.5f, 0.2f, 1.0f, 1.0f);
            pointLight.color  = new Color(0.5f, 0.2f, 1.0f, 1.0f);
        }
        if (isUnderWater)
        {
            GameObject dive     = Resources.Load <GameObject>("Dive");
            GameObject diveCopy = Instantiate(dive, transform.position, Quaternion.identity);
            diveCopy.GetComponent <Dive>().player = transform;
        }
    }