Exemplo n.º 1
0
    private void Awake()
    {
        rb2d     = GetComponent <Rigidbody2D>();
        rayCasts = GetComponent <Raycasts>();

        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <Animator>();
    }
Exemplo n.º 2
0
    private void Awake()
    {
        handler    = GetComponent <PlayerInput>();
        playerInfo = GetComponent <PlayerInfo>();
        rb2d       = GetComponent <Rigidbody2D>();
        rayCasts   = GetComponent <Raycasts>();

        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <Animator>();
    }
    private void Spawn(int i, Vector3 origin)
    {
        if (player == null || prefab == null)
        {
            return;
        }

        Physics.autoSimulation = false;
        Physics.Simulate(Time.fixedDeltaTime);
        origin.y = checkingHeight;
        Ray ray = new Ray(origin, Vector3.down);

        if (!Raycasts.RaycastNonAllocSorted(ray, false, false, layerMask))
        {
            return;
        }

        RaycastHit hit    = Raycasts.closestHit;
        Vector3    normal = hit.normal;

        origin = hit.point;

        //position
        spawnObjs[i].transform.position = origin + offset;
        // rotation
        if (prefab_enemy == null)
        {
            rotation = Quaternion.Euler(new Vector3(Random.Range(-5, 5), Random.Range(0, 360), Random.Range(-5, 5)));
            spawnObjs[i].transform.rotation = rotation;
        }
        else
        {
            rotation = Quaternion.Euler(new Vector3(0, Random.Range(0, 360), 0));
            spawnObjs[i].transform.rotation = rotation;
        }


        // scale
        if (prefab_enemy == null)
        {
            Vector3 lossyScale = new Vector3(Random.Range(0.5f, 1.5f), Random.Range(0.5f, 1.5f), Random.Range(0.5f, 1.5f));
            spawnObjs[i].transform.localScale = lossyScale;
        }
        else
        {
            Vector3 lossyScale = new Vector3(4f, 4f, 4f);
            spawnObjs[i].transform.localScale = lossyScale;
        }


        Physics.autoSimulation = true;
    }
Exemplo n.º 4
0
 void Awake()
 {
     hookshotCtrl = GameManager.instance.hookshotCtrl;
     raycasts     = GetComponent <Raycasts>();
 }
Exemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     Runanim = GetComponent <Animator>();
     ground  = GetComponent <Raycasts>();
 }
Exemplo n.º 6
0
 private void Awake()
 {
     rb          = GetComponent <Rigidbody2D>();
     jumpButt    = GetComponent <PlayerInput>();
     groundCheck = GetComponent <Raycasts>();
 }