Example #1
0
    /// <summary>
    /// 添加坦克标识
    /// </summary>
    public void AddFlag()
    {
        int        number;
        GameObject go = UnityTool.FindOneOfActiveChild(mTank.Turret.AnyTuret, "Turret");

        if (mTurretType == TurretType.ShellTurret)
        {
            number = 0;
        }
        else
        {
            number = 1;
        }
        Material[] materialarry = go.GetComponent <Renderer>().materials;
        Material   material     = FactoryManager.assetFactory.LoadMaterial("Blue");

        for (int i = 0; i < materialarry.Length; i++)
        {
            if (i == number)
            {
                materialarry[i] = material;
            }
        }
        go.GetComponent <Renderer>().sharedMaterials = materialarry;
    }
Example #2
0
 //private GameObject mAudioGO;
 public TurretLaser(GameObject gameObject, TurretAttr turretAttr) : base(gameObject, turretAttr)
 {
     mFireSpot         = UnityTool.FindOneOfActiveChild(gameObject, "FireSpot").transform;
     mLine             = mFireSpot.GetComponent <LineRenderer>();
     mLight            = mFireSpot.GetComponent <Light>();
     mAudioSource.loop = true;
     mBullet           = new Bullet();
 }
Example #3
0
    public void AddTurret()
    {
        Turret    Turret          = FactoryManager.TurretFactory.CreateTurret(mTurretType);
        Transform turretTransform = UnityTool.FindOneOfActiveChild(mTank.GameObject, "TankTurret").transform;

        mTank.Turret = Turret;
        mTank.Turret.AnyTuret.transform.position = turretTransform.position;
    }
Example #4
0
    public override void Init()
    {
        base.Init();

        //GameObject canvas = UITool.GetCanvas(); //得到主画布
        GameObject canvas = GameObject.Find("Double");

        mRootUI       = UnityTool.FindOneOfActiveChild(canvas, "Panel"); //得到Panel
        mPlayer1      = UnityTool.FindOneOfActiveChild(canvas, "Player1");
        mPlayer2      = UnityTool.FindOneOfActiveChild(canvas, "Player2");
        mToggleGroup1 = UITool.FindChild <ToggleGroup>(mRootUI, "Player1WhichTurret");
        mToggleGroup2 = UITool.FindChild <ToggleGroup>(mRootUI, "Player2WhichTurret");

        anyToggle1 = mToggleGroup1.ActiveToggles();
        anyToggle2 = mToggleGroup2.ActiveToggles();
        play1      = UnityTool.FindAllChild(mPlayer1);
        play2      = UnityTool.FindAllChild(mPlayer2);
    }
Example #5
0
 public TurretCanon(GameObject gameObject, TurretAttr turretAttr) : base(gameObject, turretAttr)
 {
     mFireSpot = UnityTool.FindOneOfActiveChild(gameObject, "FireSpot").transform;
 }