Esempio n. 1
0
    public virtual void OnEnable()
    {
        _target = (Fragmentum)target;

        if (_target.GetComponent<Renderer>() == null)
        {
            error = V_FR_ERROR.InvalidRenderer;
        }

        if (_target.renderer.sharedMaterials.Length == 0)
        {
            error = V_FR_ERROR.NoMaterials;
        }

        if (_target.GetComponent<SkinnedMeshRenderer>())
        {
            error = V_FR_ERROR.NoSkinnedMeshRendererSupport;
        }
        else if (_target.GetComponent<MeshFilter>())
            mesh = _target.GetComponent<MeshFilter>().sharedMesh;
        else
            error = V_FR_ERROR.InvalidRenderer;

        icon = Resources.Load("Fragmentum_Icon_Editor") as Texture2D;

        facebookIcon = Resources.Load("facebook_icon") as Texture2D;
        youtubeIcon = Resources.Load("youtube_icon") as Texture2D;

        textStyle.fontStyle = FontStyle.Bold;
    }
 void Awake()
 {
     audio = GetComponent<AudioSource>();
     player=GameObject.FindGameObjectWithTag("Player");
     int rnd=Random.Range(0,10);
     if(rnd>4)
     {
         startDir=-1;
     }
     Vector3 enemyScale = transform.localScale;
     enemyScale.x = startDir;
         transform.localScale = enemyScale;
     // Setting up the references.
     groundCheck = transform.Find("groundCheck");
     frontCheck = transform.Find("frontCheck").transform;
     //	score = GameObject.Find("Score").GetComponent<Score>();
     frag=GetComponent<Fragmentum>();
 }
Esempio n. 3
0
 public virtual void OnDisable()
 {
     _target = null;
 }
 void Awake()
 {
     // Setting up references.
     groundCheck = transform.Find("groundCheck");
     muzzle = transform.Find("muzzle");
     foot = transform.Find("foot");
     frag=GetComponent<Fragmentum>();
     hudLife=GameObject.FindGameObjectWithTag("HUDLife");
     HudLives.Add(hudLife);
     GameObject hudLifeInst=hudLife;
     for(int i=0;i<Lives-1;i++)
     {
         hudLifeInst=(GameObject)GameObject.Instantiate(hudLife,new Vector3( hudLifeInst.transform.position.x+1.5f,hudLifeInst.transform.position.y,hudLifeInst.transform.position.z),hudLifeInst.transform.rotation);
         HudLives.Add(hudLifeInst);
     }
 }