Inheritance: MonoBehaviour
コード例 #1
0
    public void Init(GameObject tower)
    {
        // ShowTowerPopup window = ScriptableObject.CreateInstance<ShowTowerPopup>();
        // window.position = new Rect(Screen.width / 2 + 100, Screen.height / 2 - 50, 300, 300);
        // GetComponent<Canvas> ().enabled = true;

        castle = GameObject.Find("Castle").GetComponent <CastleHealth>();
        uGen   = Camera.main.GetComponent <UnitGenerator>();
        cFire  = tower.transform.FindChild("Turret").GetComponent <CannonFire>();

        // pause game
        previousTimeScale = Time.timeScale;
        Time.timeScale    = 0;
    }
コード例 #2
0
 protected void OnTriggerEnter(Collider co)
 {
     if (co.tag == "Turret" && co is BoxCollider)
     {
         CannonFire cf = co.gameObject.GetComponent <CannonFire> ();
         if (cf != null)
         {
             NeuralNode node = cf.GetNode();
             if (node != null)
             {
                 towersToConfound [node] = new List <int> ();
             }
         }
     }
 }
コード例 #3
0
 protected virtual void OnTriggerExit(Collider co)
 {
     if (co.tag == "Turret" && co is BoxCollider)
     {
         CannonFire cf = co.gameObject.GetComponent <CannonFire> ();
         if (cf != null)
         {
             NeuralNode node = cf.GetNode();
             if (node != null)
             {
                 List <int> confoundedIndices = towersToConfound [node];
                 node.ResetWeights(confoundedIndices);
                 node.RemoveFromEnemiesToInform(this);
                 node.InformEnemies(confoundedIndices);
             }
         }
     }
 }    //OnTriggerExit()
コード例 #4
0
    void OnUnlock(GameManagerInstance.UnlockStateID id, bool oldState, bool newState)
    {
        if (id == GameManagerInstance.UnlockStateID.Possession && !oldState && newState)
        {
            GameObject child = Instantiate(TreadObj) as GameObject;
            child.transform.parent        = transform;
            child.transform.localPosition = TreadObj.transform.localPosition;
        }

        if (id == GameManagerInstance.UnlockStateID.Cannon && !oldState && newState)
        {
            GameObject child = Instantiate(CannonObj) as GameObject;
            child.transform.parent        = transform;
            child.transform.localPosition = CannonObj.transform.localPosition;
            CannonFire fireable = child.GetComponentInChildren <CannonFire>();
            fireable.FacingRightCallback = GetComponent <CharacterController2D>().FacingRight;
            FireWeapon.WrappedValue      = fireable.UseWeapon;
        }
    }
コード例 #5
0
ファイル: TankInfo.cs プロジェクト: zachdeibert/code-tanks
 public void FireCannon(int i)
 {
     CannonFire?.Invoke(i);
 }
コード例 #6
0
    public void Init(GameObject tower)
    {
        // ShowTowerPopup window = ScriptableObject.CreateInstance<ShowTowerPopup>();
        // window.position = new Rect(Screen.width / 2 + 100, Screen.height / 2 - 50, 300, 300);
        // GetComponent<Canvas> ().enabled = true;

        castle = GameObject.Find("Castle").GetComponent<CastleHealth>();
        uGen = Camera.main.GetComponent<UnitGenerator>();
        cFire = tower.transform.FindChild("Turret").GetComponent<CannonFire>();

        // pause game
        previousTimeScale = Time.timeScale;
        Time.timeScale = 0;
    }
コード例 #7
0
 // Start is called before the first frame update
 void Start()
 {
     mysmallbulletprefab = Resources.Load("prefabs/SmallBullet") as GameObject;
     mycannonfire        = GetComponent <CannonFire>();
 }
コード例 #8
0
ファイル: AudioManager.cs プロジェクト: JRagone/pirategame
 void playCannonFire(CannonFire e)
 {
     Play("Cannon");
 }
コード例 #9
0
 void Start()
 {
     Fireable = GetComponentInChildren <CannonFire>();
     Fireable.FacingRightCallback = GetComponent <CharacterController2D>().FacingRight;
     Fireable.Power = Power;
 }
コード例 #10
0
        public void PrintEntity(JObject entity, Map map, int px, int py)
        {
            GameWorld world  = map.World;
            string    type   = entity["name"].ToObject <string>();
            float     ox     = entity["x"].ToObject <float>();
            float     oy     = entity["y"].ToObject <float>();
            var       values = entity["values"];

            float x = px * 16 + ox;
            float y = py * 16 + oy;

            if (type == "ball_and_chain") //TODO: make a dictionary of (name -> generator delegate)
            {
                float rotation = entity["rotation"].ToObject <float>();
                float speed    = values["Speed"].ToObject <float>();
                float distance = values["Distance"].ToObject <float>();
                bool  swings   = values["Swings"].ToObject <bool>();

                var ballandchain = new BallAndChain(world, new Vector2(x, y), rotation, speed, distance);
                ballandchain.Swings = swings;
            }
            if (type == "moaiman")
            {
                bool flipped = entity["flippedX"].ToObject <bool>();
                var  moaiman = new MoaiMan(world, new Vector2(x, y));
                moaiman.Facing = flipped ? HorizontalFacing.Left : HorizontalFacing.Right;
            }
            if (type == "cannon")
            {
                float rotation = entity["rotation"].ToObject <float>();
                float delay    = values["Delay"].ToObject <float>();
                var   cannon   = new CannonFire(world, new Vector2(x, y), rotation);
                cannon.DelayTime = delay;
            }
            if (type == "cannon_fire")
            {
                float rotation = entity["rotation"].ToObject <float>();
                float delay    = values["Delay"].ToObject <float>();
                var   cannon   = new CannonFire(world, new Vector2(x, y), rotation);
                cannon.DelayTime = delay;
            }
            if (type == "cannon_poison")
            {
                float rotation = entity["rotation"].ToObject <float>();
                float delay    = values["Delay"].ToObject <float>();
                var   cannon   = new CannonPoisonBreath(world, new Vector2(x, y), rotation);
                cannon.DelayTime = delay;
            }
            if (type == "snake")
            {
                bool flipped = entity["flippedX"].ToObject <bool>();
                var  snake   = new Snake(world, new Vector2(x, y));
                snake.Facing = flipped ? HorizontalFacing.Left : HorizontalFacing.Right;
            }
            if (type == "hydra")
            {
                bool flipped = entity["flippedX"].ToObject <bool>();
                var  hydra   = new Hydra(world, new Vector2(x, y));
                hydra.Facing = flipped ? HorizontalFacing.Left : HorizontalFacing.Right;
            }
        }
コード例 #11
0
 public void addCannonFire(CannonFire cannon)
 {
     cannons.Add(cannon);
 }
コード例 #12
0
 public ReDeedEntry(Mobile from, CannonFire fcannon) : base(89, 3)
 {
     m_fcannon = fcannon;
     m_from    = from;
 }