Ejemplo 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());
    }
Ejemplo n.º 2
0
    public virtual void Start()
    {
        EventManager.resetObjects += Reset;
        HPModuleScript             = GetComponent <HPModule> ();
        if (HPModuleScript != null)
        {
            HPModuleScript.On_HPModule_Death += OnMonsterDeath;
        }

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

        anim             = GetComponent <Animator>();
        startingPosition = gameObject.transform.position;

        if (DefaultFacingLeft)
        {
            facingRight = false;
        }
        else
        {
            facingRight = true;
        }

        List <MethodInfo> allTheFunctions = GetFunctionList();

        PassiveAIAction    = (CustomAIAction)Delegate.CreateDelegate(typeof(CustomAIAction), this, allTheFunctions[PassiveAINumber]);
        AlertAIAction      = (CustomAIAction)Delegate.CreateDelegate(typeof(CustomAIAction), this, allTheFunctions[AlertAINumber]);
        AggressiveAIAction = (CustomAIAction)Delegate.CreateDelegate(typeof(CustomAIAction), this, allTheFunctions[AggressiveAINumber]);

        StartCoroutine(C_StartAI());
        StartCoroutine(C_CalculateSurroundings());
    }