Ejemplo n.º 1
0
 void Start()
 {
     planeTemplate = Templates.getInstance().getPlaneTemplate(planeTemplateId);
     calculatePreferencedDirection();
     GameStorage.getInstance().addToList(this);
     bodyMeshRenderer = GetComponent <MeshRenderer>();
     bodyCollider     = GetComponent <Collider>();
     initBullets();
     explosionParticle.SetActive(false);
     fillConstraints();
 }
Ejemplo n.º 2
0
 void Start()
 {
     planeTemplate          = Templates.getInstance().getPlaneTemplate(planeTemplateId);
     attackIconMeshRenderer = attackIcon.GetComponent <SpriteRenderer>();
     lineRenderer           = gameObject.GetComponent <LineRenderer>();
     bodyMeshRenderer       = GetComponent <MeshRenderer>();
     bodyCollider           = GetComponent <Collider>();
     explosionParticle.SetActive(false);
     GameStorage.getInstance().addToList(this);
     fillConstraints();
     initBullets();
     createArcs();
     updateAttackIconPosition();
     CalculatePath();
     initAbils();
 }
Ejemplo n.º 3
0
	void Start () {
		planeTemplate=Templates.getInstance().getPlaneTemplate(planeTemplateId);
		attackIconMeshRenderer=attackIcon.GetComponent<SpriteRenderer>();
		lineRenderer=gameObject.GetComponent<LineRenderer>();
		bodyMeshRenderer=GetComponent<MeshRenderer>();
		bodyCollider=GetComponent<Collider>();
		explosionParticle.SetActive(false);
		GameStorage.getInstance().addToList(this);
		fillConstraints();
		initBullets();
		createArcs();
		updateAttackIconPosition();
		CalculatePath();
		initAbils();
	}
Ejemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     GameStorage.getInstance().addEnemyShuttle(this.gameObject);
     temp = Templates.getInstance().getPlaneTemplate(Template);
     foreach(int abils in temp.abilities)
         privateAbils.Add(abils);
     LineRenderer lr = gameObject.AddComponent<LineRenderer>();
     lr.SetWidth(0.05f, 0.05f);
     GameObject gD;
     int gunsl=0,gunsr=0;
     foreach(Templates.GunOnShuttle goss in temp.guns)
     {
         if(goss.pos.x<0) gunsl++;
         if(goss.pos.x>0) gunsr++;
         gD=(GameObject) Instantiate(Resources.Load("prefab/testGunMesh") as GameObject,new Vector3(transform.position.x+goss.pos.x,1,transform.position.z+goss.pos.y),Quaternion.Euler(0,goss.turnAngle,0));
         gD.SetActive(false);
         shuttleGunsMeshes.Add(gD);
         shuttleGunsGos.Add(goss);
     }
     if(gunsr>gunsl) preferencedDirection=1;
     if(gunsl>gunsr) preferencedDirection=-1;
     hp=temp.hp;
     calculateMovePosition();
 }
Ejemplo n.º 5
0
	void Start () {
		planeTemplate=Templates.getInstance().getPlaneTemplate(planeTemplateId);
		calculatePreferencedDirection();
		GameStorage.getInstance().addToList(this);
		bodyMeshRenderer=GetComponent<MeshRenderer>();
		bodyCollider=GetComponent<Collider>();
		initBullets();
		explosionParticle.SetActive(false);
		fillConstraints();
	}
    void Start()
    {
        attackIcon = Instantiate(Resources.Load("prefab/attackIcon") as GameObject);
        attackIcon.SetActive(false);
        if(GameStorage.getInstance().getFixedTime()==-1)
            GameStorage.getInstance().overlap=false;

        LineRenderer lr = gameObject.AddComponent<LineRenderer>();
        lr.SetWidth(0.05f, 0.05f);
        GameStorage.getInstance().addFriendlyShuttle(this.gameObject);
        temp = Templates.getInstance().getPlaneTemplate(Template);
        foreach(int abils in temp.abilities)
            privateAbils.Add(abils);
        GameStorage.getInstance().totalHp+=temp.hp;
        GameObject go;
        MeshRenderer mr;
        lineMat = Resources.Load("materials/holograms/Hologram3") as Material;
        lr.material=lineMat;
        Mesh m;
        foreach(Templates.GunOnShuttle goss in temp.guns)
        {
            go = GameObject.CreatePrimitive(PrimitiveType.Cube);
            Templates.GunTemplate gt = Templates.getInstance().getGunTemplate(goss.gunId);

            Destroy(go.GetComponent<Collider>());
            mr = go.GetComponent<MeshRenderer>();
            mr.material=Resources.Load("materials/arc") as Material;
          	m = go.GetComponent<MeshFilter>().mesh;
          	m.Clear();
            Vector3[] vertices = new Vector3[101];
            vertices[0]=new Vector3(0,1,0);
            float ds=gt.attackRange;

            Vector2 va;
            int i=1;
            for(float ang = -gt.attackAngle; ang<=gt.attackAngle; ang+=(2*gt.attackAngle)/100.0f)
            {
                va=Quaternion.Euler(0,0,ang)*new Vector2(0,ds);
                vertices[i]=new Vector3(va.x,0,va.y);
                i++;
                if(i==101) break;
            }

            int[] triangles = new int[vertices.Length*3];
            int bb=0;
            for(i=0;i<99;i++)
            {
                triangles[bb*3]=0;
                triangles[bb*3+1]=i+1;
                triangles[bb*3+2]=i+2;
                bb++;
            }

            Vector2[] uvs = new Vector2[vertices.Length];
            for (i = 0; i < uvs.Length; i++) {
                uvs[i] = new Vector2(vertices[i].x, vertices[i].z);
            }

            m.vertices=vertices;
            m.triangles=triangles;
            m.uv=uvs;
           	m.RecalculateBounds();
            m.RecalculateNormals();
            arcObjs.Add(go);

            go=(GameObject) Instantiate(Resources.Load("prefab/testGunMesh") as GameObject,new Vector3(transform.position.x+goss.pos.x,1,transform.position.z+goss.pos.y),Quaternion.Euler(0,goss.turnAngle,0));
            go.SetActive(false);
            shuttleGunsMeshes.Add(go);
            shuttleGunsGos.Add(goss);
        }

        attackIconDistMin = temp.minRange;
        attackIconDist = temp.maxRange;
        maxTurnAngle = temp.maxTurnAngle;
        hp=temp.hp;

        if(temp.abilities.Count>=1)
            origin0=(Abilities.AbilityType) temp.abilities[0];
        if(temp.abilities.Count>=2)
            origin1=(Abilities.AbilityType) temp.abilities[1];
        if(temp.abilities.Count>=3)
            origin2=(Abilities.AbilityType) temp.abilities[2];
        if(temp.abilities.Count>=4)
            origin3=(Abilities.AbilityType) temp.abilities[3];
    }