Esempio n. 1
0
    void Start()
    {
        if (GetComponent <HPModule>())
        {
            HPModule TEMP = GetComponent <HPModule>();
            TEMP.On_HPModule_Death += MonsterDeath;
        }

        EventManager.resetObjects += Reset;
        startingPosition           = gameObject.transform.position;

        if (JumpPower == 0)
        {
            JumpSpeed = 0;
        }

        anim = GetComponent <Animator>();
        if (DefaultFacingRight)
        {
            Vector3 theScale = transform.localScale;
            theScale.x          *= -1;
            transform.localScale = theScale;
//			BackupScale = theScale;

            Canvas[] childCanvases = GetComponentsInChildren <Canvas> ();
            foreach (Canvas child in childCanvases)
            {
                theScale    = child.transform.localScale;
                theScale.x *= -1;
                child.transform.localScale = theScale;
            }
        }

        MonsterManipulation = gameObject.AddComponent <NewObjectSpawner> ();
        MonsterManipulation.SetProjectile(0, MonsterProjectile);
        MonsterManipulation.SetToEnablePooling(0, false);

        if (GetComponent <CalculateChecks> ())
        {
            calculateChecks = GetComponent <CalculateChecks> ();
        }
        else
        {
            calculateChecks = gameObject.AddComponent <CalculateChecks> ();
        }
        calculateChecks.ChangeLayerMask(whatIsGround);
        calculateChecks.Set_ColliderIndent(ColliderIndent);

        StartCoroutine(C_StartAI());
    }
    void Start()
    {
        EventManager.resetObjects += Reset;
        startingPosition           = gameObject.transform.position;

        anim = GetComponent <Animator>();
        if (DefaultFacingRight)
        {
            Vector3 theScale = transform.localScale;
            theScale.x          *= -1;
            transform.localScale = theScale;

            Canvas[] childCanvases = GetComponentsInChildren <Canvas> ();
            foreach (Canvas child in childCanvases)
            {
                theScale    = child.transform.localScale;
                theScale.x *= -1;
                child.transform.localScale = theScale;
            }
        }

        MonsterManipulation = gameObject.AddComponent <NewObjectSpawner> ();
        MonsterManipulation.SetProjectile(0, MonsterProjectile);
        MonsterManipulation.SetToEnablePooling(0, false);

//		MonsterManipulation.AddSelfToList (0);
//		MonsterManipulation.ChangeColor_Children (0, 1f);
//		MonsterManipulation.SetColor_Random (0);
//		MonsterManipulation.SetKinematicObjects (0, false);
//		ScaleModifier = gameObject.transform.localScale.x;

        if (GetComponent <CalculateChecks> ())
        {
            calculateChecks = GetComponent <CalculateChecks> ();
        }
        else
        {
            calculateChecks = gameObject.AddComponent <CalculateChecks> ();
        }
        calculateChecks.ChangeLayerMask(whatIsGround);

        StartCoroutine(C_StartAI());
    }