Exemple #1
0
 private void FixedUpdate()
 {
     if (isProducer && canProducing)
     {
         if (localProgress > localPeriod)
         {
             // Instantiate produce prefab
             subInstance = Instantiate(subPrefab, transform.position + new Vector3(0, 0.5f, 0), Quaternion.identity);
             subInstance.transform.SetParent(transform);
             DropResource dr = subInstance.GetComponent <DropResource>();
             if (dr != null)
             {
                 dr.position = this.position;
             }
             localProgress -= localPeriod;
             canProducing   = false;
         }
         else
         {
             localProgress += Time.fixedDeltaTime;
             BuffConsult();
         }
     }
     BuffConsult();
 }
Exemple #2
0
    public override void BeforeDead()
    {
        base.BeforeDead();
        foreach (Corner c in m_corners)
        {
            c.RemoveLife(this.m_Property);
        }
        int wood = m_Attr.Wood;

        if (wood > 0)
        {
            Vector3 pos = MapGrid.GetMG(Layer, StartUnit).pos;
            pos += new Vector3(0, 0.5f, 1.2f);
            DropResource.Drop(ResourceType.Wood, wood, pos);
            CmCarbon.SetAddWinWood(wood);
        }
        int stone = m_Attr.Stone;

        if (stone > 0)
        {
            Debug.Log("get stone:" + stone + "," + this);
        }
        int steel = m_Attr.Steel;

        if (steel > 0)
        {
            Debug.Log("get steel:" + steel + "," + this);
        }
        List <Life> listRAW = new List <Life>();

        CM.SearchLifeMListInBoat(ref listRAW, LifeMType.SOLDIER);
        foreach (Life item in listRAW)
        {
            Role raw = item as Role;
            raw.ChangeTarget(ChangeTargetReason.ClearOtherTarget, this);
        }

        Destroy();
        SetWallGridDead();
        //by zhlin  临时屏蔽
        //CancelInvoke("CloseDoor");
    }
Exemple #3
0
    public override void BeforeDead()
    {
        base.BeforeDead();
        int wood = m_Attr.Wood;

        if (wood > 0)
        {
            Vector3 pos = MapGrid.GetMG(m_Attr.Pos).pos;
            pos += new Vector3(0, 0.5f, 1.2f);//此处y控制深度, z控制高度

            DropResource.Drop(ResourceType.Wood, wood, pos);
            CmCarbon.SetAddWinWood(wood);
        }
        int stone = m_Attr.Stone;

        if (stone > 0)
        {
            Debug.Log("get stone:" + stone + "," + this);
        }
        int steel = m_Attr.Steel;

        if (steel > 0)
        {
            Debug.Log("get steel:" + steel + "," + this);
        }

        List <Life> listRAW = new List <Life>();

        CM.SearchLifeMListInBoat(ref listRAW, LifeMType.SOLDIER, LifeMCamp.ATTACK);

        foreach (var item in listRAW)
        {
            Role r = item as Role;
            r.ChangeTarget(ChangeTargetReason.ClearOtherTarget, this);
        }
        EventCenter.AntiRegisterHooks(NDEventType.StatusCG, SetStatus);
        Destroy();
    }