Ejemplo n.º 1
0
 public void Remove()
 {
     land.SetBuilding(null);
     land.AddFunction(Land.LandFunction.buildBuilding);
     pipeManager.SetIfDenyForward(true);
     Destroy(gameObject);
 }
Ejemplo n.º 2
0
    private void Start()
    {
        bulletNum = 0;
        land      = transform.GetComponentInParent <Land>();
        player    = land.GetPlayer();
        land.AddFunction(Land.LandFunction.shoot);
        resourcesManager = transform.GetComponentInParent <ResourcesManager>();//
        innerTimer       = updateFreq;
        canUpdate        = true;

        StartCoroutine("AutoShootCor");
    }
Ejemplo n.º 3
0
    private bool denyForward;//是否拒绝传递,为true则不会向上游请求

    private void Start()
    {
        pipesFrom        = new List <Pipe>();
        resourcesManager = GetComponent <ResourcesManager>();
        land             = GetComponent <Land>();
        land.AddFunction(Land.LandFunction.buildPipe);

        denyForward      = true;//
        resourcesManager = GetComponent <ResourcesManager>();
        resourcesManager.OnResourcesLack += (object sender, ResourceRequire e) => {
            RequestForward(e, 0);//本站资源不足,转发请求
        };
        land.OnBelongPlayerChange += (object sender, EventArgs e) => {
            foreach (Pipe pipe in pipesFrom)
            {
                pipe.Disconnect();                             //被占领时断链
            }
            foreach (Pipe pipe in pipesTo)
            {
                pipe.Disconnect();
            }
        };
    }