Exemple #1
0
    // Use this for initialization
    void Start()
    {
        spikesAnimator = GetComponent <Animator>();

        spikesLeft1 = transform.FindChild("SpikesLeft1").gameObject;
        if (spikesLeft1 == null)
        {
            Debug.LogError("Error : SpikesLeft1 not found");
        }

        spikesRight1 = transform.FindChild("SpikesRight1").gameObject;
        if (spikesRight1 == null)
        {
            Debug.LogError("Error : SpikesRight1 not found");
        }

        thePlayer = GameObject.FindGameObjectWithTag("Player");
        if (thePlayer == null)
        {
            Debug.Log("Error: player not found.");
        }

        rightSphere = transform.parent.FindChild("RightSphere").gameObject;
        if (rightSphere == null)
        {
            Debug.Log("Error: rightSphere not found.");
        }

        leftSphere = transform.parent.FindChild("LeftSphere").gameObject;
        if (leftSphere == null)
        {
            Debug.Log("Error: leftSphere not found.");
        }

        safeAreaRightScript = transform.parent.FindChild("SafeAreaRight").gameObject.GetComponent <SafeAreaRight>();
        if (safeAreaRightScript == null)
        {
            Debug.Log("Error: safeAreaRightScript not found");
        }

        safeAreaLeftScript = transform.parent.FindChild("SafeAreaLeft").gameObject.GetComponent <SafeAreaLeft>();
        if (safeAreaLeftScript == null)
        {
            Debug.Log("Error: safeAreaLeftScript not found");
        }
    }
    // Use this for initialization
    void Start()
    {
        spikesAnimator = GetComponent <Animator>();

        spikesLeft1 = transform.FindChild("SpikesLeft1").gameObject;
        if (spikesLeft1 == null)
        {
            Debug.LogError("Error : SpikesLeft1 not found");
        }

        spikesLeft2 = transform.FindChild("SpikesLeft2").gameObject;
        if (spikesLeft2 == null)
        {
            Debug.LogError("Error : SpikesLeft2 not found");
        }

        spikesRight1 = transform.FindChild("SpikesRight1").gameObject;
        if (spikesRight1 == null)
        {
            Debug.LogError("Error : SpikesRight1 not found");
        }

        spikesRight2 = transform.FindChild("SpikesRight2").gameObject;
        if (spikesRight2 == null)
        {
            Debug.LogError("Error : SpikesRight2 not found");
        }

        thePlayer = GameObject.FindGameObjectWithTag("Player");
        if (thePlayer == null)
        {
            Debug.Log("Error: player not found.");
        }

        //rightSphere = transform.parent.FindChild("RightSphere").gameObject;
        //if (rightSphere == null)
        //    Debug.Log("Error: rightSphere not found.");

        //leftSphere = transform.parent.FindChild("LeftSphere").gameObject;
        //if (leftSphere == null)
        //    Debug.Log("Error: leftSphere not found.");

        safeAreaRightScript = transform.parent.FindChild("SafeAreaRight").gameObject.GetComponent <SafeAreaRight>();
        if (safeAreaRightScript == null)
        {
            Debug.Log("Error: safeAreaRightScript not found");
        }

        safeAreaLeftScript = transform.parent.FindChild("SafeAreaLeft").gameObject.GetComponent <SafeAreaLeft>();
        if (safeAreaLeftScript == null)
        {
            Debug.Log("Error: safeAreaLeftScript not found");
        }

        leftDust1PS = transform.parent.FindChild("LeftDust1").gameObject.GetComponent <ParticleSystem>();
        leftDust1PS.gameObject.SetActive(false);

        leftDust2PS = transform.parent.FindChild("LeftDust2").gameObject.GetComponent <ParticleSystem>();
        leftDust2PS.gameObject.SetActive(false);

        middleDustPS = transform.parent.FindChild("MiddleDust").gameObject.GetComponent <ParticleSystem>();
        middleDustPS.gameObject.SetActive(false);

        rightDust1PS = transform.parent.FindChild("RightDust1").gameObject.GetComponent <ParticleSystem>();
        rightDust1PS.gameObject.SetActive(false);

        rightDust2PS = transform.parent.FindChild("RightDust2").gameObject.GetComponent <ParticleSystem>();
        rightDust2PS.gameObject.SetActive(false);
    }